Move test cases to test dir
This commit is contained in:
28
src/timestamp/test/gtest_timestamp.cpp
Normal file
28
src/timestamp/test/gtest_timestamp.cpp
Normal 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();
|
||||
}
|
||||
Reference in New Issue
Block a user