aboutsummaryrefslogtreecommitdiffstats
path: root/test/base/database.cpp
diff options
context:
space:
mode:
Diffstat (limited to '')
-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);