Move test cases to test dir

This commit is contained in:
luwenpeng
2023-12-22 14:54:25 +08:00
parent 2aeb699359
commit 6ed321caea
19 changed files with 1553 additions and 1535 deletions

View File

@@ -0,0 +1,28 @@
#include <gtest/gtest.h>
#include "timestamp.h"
TEST(TIMESTAMP, GET)
{
uint64_t sec = 0;
uint64_t msec = 0;
for (int i = 0; i < 4; i++)
{
timestamp_update();
sec = timestamp_get_sec();
msec = timestamp_get_msec();
printf("current ts in sec : %lu\n", sec);
printf("current ts in msec : %lu\n", msec);
EXPECT_TRUE(sec == msec / 1000);
sleep(i);
printf("sleep %ds\n", i);
}
}
int main(int argc, char **argv)
{
::testing::InitGoogleTest(&argc, argv);
return RUN_ALL_TESTS();
}