aboutsummaryrefslogtreecommitdiffstats
path: root/test
diff options
context:
space:
mode:
authorAlexander Sulfrian <alexander@sulfrian.net>2010-01-05 20:15:48 +0100
committerAlexander Sulfrian <alexander@sulfrian.net>2013-01-05 17:17:43 +0100
commit19d2a7165559e5fc55e9128553433ee9fedb4bd8 (patch)
tree7425b2be763343c44b307a5e26280a060c1d9549 /test
parentd491aaab13a7719fe31c7474f09d86f3cd0c53f7 (diff)
downloadusdx-19d2a7165559e5fc55e9128553433ee9fedb4bd8.tar.gz
usdx-19d2a7165559e5fc55e9128553433ee9fedb4bd8.tar.xz
usdx-19d2a7165559e5fc55e9128553433ee9fedb4bd8.zip
implement get_stat_reset, format_date; added some tests
Diffstat (limited to 'test')
-rw-r--r--test/base/database.cpp20
1 files changed, 20 insertions, 0 deletions
diff --git a/test/base/database.cpp b/test/base/database.cpp
index 52635687..5738c56c 100644
--- a/test/base/database.cpp
+++ b/test/base/database.cpp
@@ -38,6 +38,9 @@ namespace usdx
CPPUNIT_TEST(testNotNull);
CPPUNIT_TEST(testGetVersion);
CPPUNIT_TEST(testSetAndGetVersion);
+ CPPUNIT_TEST(testSizeOfTime_t);
+ CPPUNIT_TEST(testGetStatReset);
+ CPPUNIT_TEST(testFormatDate);
CPPUNIT_TEST_SUITE_END();
private:
StatDatabase *db;
@@ -70,6 +73,23 @@ namespace usdx
StatDatabase::get_instance()->set_version(1);
CPPUNIT_ASSERT( 1 == StatDatabase::get_instance()->get_version() );
}
+
+ void testSizeOfTime_t()
+ {
+ CPPUNIT_ASSERT( sizeof(time_t) == sizeof(long) );
+ }
+
+ void testGetStatReset()
+ {
+ CPPUNIT_ASSERT( 1000000000 < StatDatabase::get_instance()->get_stat_reset() );
+ }
+
+ void testFormatDate()
+ {
+ char buf[9];
+ StatDatabase::get_instance()->format_date(buf, 9, 1262433600);
+ CPPUNIT_ASSERT( strcmp(buf, "13.02.09") );
+ }
};
CPPUNIT_TEST_SUITE_REGISTRATION(StatDatabaseTest);