Lines Matching refs:TokenDatabase
30 alignas(TokenDatabase::RawEntry) constexpr char kBasicData[] =
39 alignas(TokenDatabase::RawEntry) constexpr char kEmptyData[] =
42 alignas(TokenDatabase::RawEntry) constexpr char kBadMagic[] =
47 alignas(TokenDatabase::RawEntry) constexpr char kBadVersion[] =
50 alignas(TokenDatabase::RawEntry) constexpr char kBadEntryCount[] =
55 alignas(TokenDatabase::RawEntry) constexpr signed char kSignedWithTopBit[] =
80 constexpr TokenDatabase kBasicDatabase = TokenDatabase::Create<kBasicData>();
83 TEST(TokenDatabase, EntryCount) { in TEST() argument
84 static_assert(TokenDatabase::Create<kBasicData>().size() == 3u); in TEST()
85 static_assert(TokenDatabase::Create(kEmptyData).size() == 0u); in TEST()
86 EXPECT_EQ(TokenDatabase::Create<kSignedWithTopBit>().size(), 0x80u); in TEST()
89 TEST(TokenDatabase, ValidCheck) { in TEST() argument
92 EXPECT_TRUE(TokenDatabase::IsValid(basic_data)); in TEST()
94 static_assert(TokenDatabase::IsValid(kBasicData)); in TEST()
95 static_assert(TokenDatabase::IsValid(kEmptyData)); in TEST()
96 static_assert(TokenDatabase::IsValid(kSignedWithTopBit)); in TEST()
98 static_assert(!TokenDatabase::IsValid(kBadMagic)); in TEST()
99 static_assert(!TokenDatabase::IsValid(kBadVersion)); in TEST()
100 static_assert(!TokenDatabase::IsValid(kBadEntryCount)); in TEST()
102 static_assert(!TokenDatabase::IsValid("TOKENS\0\0\0\0")); // too short in TEST()
103 static_assert(!TokenDatabase::IsValid("TOKENS\0\1\0\0\0\0\0\0\0\0")); in TEST()
104 static_assert(!TokenDatabase::IsValid("TOKENSv0\0\0\0\0\0\0\0\0")); in TEST()
105 static_assert(!TokenDatabase::IsValid("tokens\0\0\0\0\0\0\0\0\0\0")); in TEST()
109 !TokenDatabase::IsValid("TOKENS\0\0\x01\x00\x00\x00\0\0\0\0WXYZdate"sv)); in TEST()
113 TokenDatabase::IsValid("TOKENS\0\0\x01\x00\x00\x00\0\0\0\0WXYZdate\0"sv)); in TEST()
116 !TokenDatabase::IsValid("TOKENS\0\0\x02\x00\x00\x00\0\0\0\0" in TEST()
121 TokenDatabase::IsValid("TOKENS\0\0\x02\x00\x00\x00\0\0\0\0" in TEST()
126 TokenDatabase::IsValid("TOKENS\0\0\x02\x00\x00\x00\0\0\0\0" in TEST()
132 TEST(TokenDatabase, Iterator) { in TEST() argument
153 TEST(TokenDatabase, Iterator_PreIncrement) { in TEST() argument
159 TEST(TokenDatabase, Iterator_PostIncrement) { in TEST() argument
167 TEST(TokenDatabase, SingleEntryLookup_FirstEntry) { in TEST() argument
179 TEST(TokenDatabase, SingleEntryLookup_MiddleEntry) { in TEST() argument
186 TEST(TokenDatabase, SingleEntryLookup_LastEntry) { in TEST() argument
193 TEST(TokenDatabase, SingleEntryLookup_NonPresent) { in TEST() argument
200 TEST(TokenDatabase, SingleEntryLookup_NoMatches) { in TEST() argument
202 TokenDatabase tokens = TokenDatabase::Create(kBasicData); in TEST()
213 alignas(TokenDatabase::RawEntry) constexpr char kCollisionsData[] =
222 constexpr TokenDatabase kCollisions = TokenDatabase::Create<kCollisionsData>();
225 TEST(TokenDatabase, MultipleEntriesWithSameToken) { in TEST() argument
226 TokenDatabase::Entries match = kCollisions.Find(1); in TEST()
241 TEST(TokenDatabase, Empty) { in TEST() argument
242 constexpr TokenDatabase empty_db = TokenDatabase::Create<kEmptyData>(); in TEST()
255 TEST(TokenDatabase, NullDatabase) { in TEST() argument
256 constexpr TokenDatabase empty_db; in TEST()
263 TEST(TokenDatabase, InvalidData) { in TEST() argument
264 constexpr TokenDatabase bad_db = TokenDatabase::Create("TOKENS\0\0"); in TEST()
270 TEST(TokenDatabase, FromString) { in TEST() argument
271 TokenDatabase bad_db = TokenDatabase::Create(std::string("wow!")); in TEST()