memgraph/tests/unit/utils_timestamp.cpp

26 lines
618 B
C++
Raw Normal View History

#include <chrono>
#include <iostream>
#include <thread>
#include <gtest/gtest.h>
#include <utils/timestamp.hpp>
2017-02-20 06:47:09 +08:00
TEST(TimestampTest, BasicUsage) {
auto timestamp = utils::Timestamp::Now();
std::cout << timestamp << std::endl;
std::cout << utils::Timestamp::Now() << std::endl;
std::this_thread::sleep_for(std::chrono::milliseconds(250));
std::cout << utils::Timestamp::Now().ToIso8601() << std::endl;
ASSERT_GT(utils::Timestamp::Now(), timestamp);
2017-02-20 06:47:09 +08:00
std::cout << std::boolalpha;
std::cout << (timestamp == utils::Timestamp::Now()) << std::endl;
ASSERT_NE(timestamp, utils::Timestamp::Now());
2017-02-20 06:47:09 +08:00
}