2017-02-20 06:47:09 +08:00
|
|
|
#include "gtest/gtest.h"
|
2017-02-19 01:03:48 +08:00
|
|
|
|
|
|
|
#include "mvcc/id.hpp"
|
|
|
|
|
2017-02-20 06:47:09 +08:00
|
|
|
TEST(IdTest, BasicUsageAndTotalOrdering) {
|
2017-02-19 01:03:48 +08:00
|
|
|
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);
|
|
|
|
}
|
2017-02-19 01:03:48 +08:00
|
|
|
|
2017-04-14 23:32:59 +08:00
|
|
|
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();
|
2017-02-19 01:03:48 +08:00
|
|
|
}
|