diff options
Diffstat (limited to 'src')
-rw-r--r-- | src/Makefile.am | 6 | ||||
-rw-r--r-- | src/tests/Makefile.am | 46 | ||||
-rw-r--r-- | src/tests/testaccount.cpp | 8 | ||||
-rw-r--r-- | src/tests/teststorage.cpp | 5 |
4 files changed, 57 insertions, 8 deletions
diff --git a/src/Makefile.am b/src/Makefile.am index d567125b..e40dc501 100644 --- a/src/Makefile.am +++ b/src/Makefile.am @@ -71,4 +71,8 @@ tmwserv_SOURCES += script.h \ endif tmwserv_CXXFLAGS = -Wall -fno-inline -tmwserv_TARGET = tmwserv + + +# do not remove the 'dot', it is a hint for Automake. +# it causes a prefix ordering of directories. +SUBDIRS = . tests diff --git a/src/tests/Makefile.am b/src/tests/Makefile.am new file mode 100644 index 00000000..c8f53d06 --- /dev/null +++ b/src/tests/Makefile.am @@ -0,0 +1,46 @@ +# $Id$ + + +if UNIT_TESTS_YES + +bin_PROGRAMS = tmwserv_test + +tmwserv_test_SOURCES = testsmain.cpp \ + testaccount.h \ + testaccount.cpp \ + testcipher.h \ + testcipher.cpp \ + testdataprovider.h \ + testdataprovider.cpp \ + testrecordset.h \ + testrecordset.cpp \ + teststorage.h \ + teststorage.cpp + +tmwserv_test_CXXFLAGS = -Wall $(CPPUNIT_CXXFLAGS) + +tmwserv_test_LDFLAGS = $(CPPUNIT_LIBS) + +tmwserv_test_LDADD = ../tmwserv-account.o \ + ../tmwserv-cipher.o \ + ../tmwserv-dalstorage.o \ + ../tmwserv-dataprovider.o \ + ../tmwserv-dataproviderfactory.o \ + ../tmwserv-logger.o \ + ../tmwserv-object.o \ + ../tmwserv-recordset.o \ + ../tmwserv-storage.o + +if BUILD_MYSQL +tmwserv_test_LDADD += ../tmwserv-mysqldataprovider.o +endif + +if BUILD_POSTGRESQL +tmwserv_test_LDADD += ../tmwserv-pqdataprovider.o +endif + +if BUILD_SQLITE +tmwserv_test_LDADD += ../tmwserv-sqlitedataprovider.o +endif + +endif diff --git a/src/tests/testaccount.cpp b/src/tests/testaccount.cpp index a4061164..987ab81c 100644 --- a/src/tests/testaccount.cpp +++ b/src/tests/testaccount.cpp @@ -96,7 +96,7 @@ AccountTest::testCreate1(void) Beings& characters = account.getCharacters(); - for (int i = 0; i < mCharacters.size(); ++i) { + for (size_t i = 0; i < mCharacters.size(); ++i) { CPPUNIT_ASSERT_EQUAL(characters[i]->getName(), mCharacters[i]->getName()); } @@ -126,7 +126,7 @@ AccountTest::testCreate2(void) Beings& characters = account.getCharacters(); - for (int i = 0; i < mCharacters.size(); ++i) { + for (size_t i = 0; i < mCharacters.size(); ++i) { CPPUNIT_ASSERT_EQUAL(characters[i]->getName(), mCharacters[i]->getName()); } @@ -151,7 +151,7 @@ AccountTest::testAddCharacter1(void) names.push_back("pippin"); names.push_back("bilbo"); - for (int i = 0; i < mCharacters.size(); ++i) { + for (size_t i = 0; i < mCharacters.size(); ++i) { CPPUNIT_ASSERT_EQUAL(mCharacters[i]->getName(), names[i]); } @@ -174,7 +174,7 @@ AccountTest::testAddCharacter2(void) names.push_back("merry"); names.push_back("pippin"); - for (int i = 0; i < mCharacters.size(); ++i) { + for (size_t i = 0; i < mCharacters.size(); ++i) { CPPUNIT_ASSERT_EQUAL(mCharacters[i]->getName(), names[i]); } } diff --git a/src/tests/teststorage.cpp b/src/tests/teststorage.cpp index 9757fdf3..ac831513 100644 --- a/src/tests/teststorage.cpp +++ b/src/tests/teststorage.cpp @@ -301,9 +301,8 @@ StorageTest::insertAccount(std::auto_ptr<DataProvider>& db, // the password will be identical to the name. - sql << "insert into " << ACCOUNTS_TBL_NAME - << "(username, password, email, level, banned) values " - << "('" << name << "', '" << name << "', '" + sql << "insert into " << ACCOUNTS_TBL_NAME << " values " + << "(null, '" << name << "', '" << name << "', '" << name << "@domain', 1, 0);"; db->execSql(sql.str()); |