X-Git-Url: https://git.m6w6.name/?a=blobdiff_plain;f=libtest%2Funittest.cc;h=3d85b77d6186e3731c065ceaf55d05001523a56a;hb=1a09bec1c62a5068126735cc0915020bf487f4b1;hp=c0381f4d66155f65b39f5b22b5f1b993289e67d1;hpb=25efe3485198149616820ab4e52d2f18f0abe5a7;p=m6w6%2Flibmemcached diff --git a/libtest/unittest.cc b/libtest/unittest.cc index c0381f4d..3d85b77d 100644 --- a/libtest/unittest.cc +++ b/libtest/unittest.cc @@ -179,7 +179,6 @@ static test_return_t var_drizzle_exists_test(void *) static test_return_t var_tmp_test(void *) { FILE *file= fopen("var/tmp/junk", "w+"); - char buffer[1024]; test_true(file); fclose(file); return TEST_SUCCESS; @@ -726,6 +725,21 @@ static test_return_t check_dns_TEST(void *) return TEST_SUCCESS; } +static test_return_t Timer_TEST(void *) +{ + int64_t minutes= random() % 50; + minutes++; + + Timer check; + + check.reset(); + check.offset(minutes, 2, 200); + + test_compare(check.minutes(), minutes); + + return TEST_SUCCESS; +} + static test_return_t lookup_true_TEST(void *) { test_warn(libtest::lookup("exist.gearman.info"), "dns is not currently working"); @@ -913,6 +927,11 @@ test_st create_tmpfile_TESTS[] ={ {0, 0, 0} }; +test_st timer_TESTS[] ={ + {"libtest::Timer", 0, Timer_TEST }, + {0, 0, 0} +}; + test_st dns_TESTS[] ={ {"libtest::lookup(true)", 0, lookup_true_TEST }, {"libtest::lookup(false)", 0, lookup_false_TEST }, @@ -979,6 +998,7 @@ collection_st collection[] ={ {"number_of_cpus()", 0, 0, number_of_cpus_TESTS }, {"create_tmpfile()", 0, 0, create_tmpfile_TESTS }, {"dns", 0, 0, dns_TESTS }, + {"libtest::Timer", 0, 0, timer_TESTS }, {0, 0, 0, 0} };