memgraph/tests/unit/id.cpp

31 lines
630 B
C++
Raw Normal View History

2017-02-20 06:47:09 +08:00
#include "gtest/gtest.h"
#include "mvcc/id.hpp"
2017-02-20 06:47:09 +08:00
TEST(IdTest, BasicUsageAndTotalOrdering) {
Id id0(0);
Id id1(1);
Id id2(1);
Id id3(id2);
Id id4 = id3;
Id id5(5);
2017-02-20 06:47:09 +08:00
ASSERT_EQ(id0 < id5, true);
ASSERT_EQ(id1 == id2, true);
ASSERT_EQ(id3 == id4, true);
ASSERT_EQ(id5 > id0, true);
ASSERT_EQ(id5 > id0, true);
ASSERT_EQ(id5 != id3, true);
ASSERT_EQ(id1 >= id2, true);
ASSERT_EQ(id3 <= id4, true);
}
TEST(IdTest, MaxId) {
EXPECT_TRUE(Id(std::numeric_limits<uint64_t>::max()) == Id::MaximalId());
}
2017-02-20 06:47:09 +08:00
int main(int argc, char **argv) {
::testing::InitGoogleTest(&argc, argv);
return RUN_ALL_TESTS();
}