• Home
  • Raw
  • Download

Lines Matching refs:Bitfield

20   using Bool = Bitfield::Element<bool, 0, 1>;  in TEST()
21 Bitfield::set<Bool>(Storage, true); in TEST()
24 EXPECT_EQ(Bitfield::get<Bool>(Storage), true); in TEST()
30 using Suit = Bitfield::Element<SuitEnum, 1, 2, SuitEnum::SPADES>; in TEST()
31 Bitfield::set<Suit>(Storage, SuitEnum::HEARTS); in TEST()
34 EXPECT_EQ(Bitfield::get<Suit>(Storage), SuitEnum::HEARTS); in TEST()
37 using Value = Bitfield::Element<unsigned, 3, 5>; in TEST()
38 Bitfield::set<Value>(Storage, 10); in TEST()
41 EXPECT_EQ(Bitfield::get<Value>(Storage), 10U); in TEST()
44 using SignedValue = Bitfield::Element<int, 3, 5>; in TEST()
45 Bitfield::set<SignedValue>(Storage, -2); in TEST()
48 EXPECT_EQ(Bitfield::get<SignedValue>(Storage), -2); in TEST()
51 EXPECT_TRUE(Bitfield::test<Value>(Storage)); in TEST()
55 EXPECT_EQ(Bitfield::get<Bool>(Storage), false); in TEST()
56 EXPECT_EQ(Bitfield::get<Suit>(Storage), SuitEnum::CLUBS); in TEST()
57 EXPECT_EQ(Bitfield::get<Value>(Storage), 0U); in TEST()
58 EXPECT_EQ(Bitfield::get<SignedValue>(Storage), 0); in TEST()
61 EXPECT_EQ(Bitfield::get<Bool>(Storage), true); in TEST()
62 EXPECT_EQ(Bitfield::get<Suit>(Storage), SuitEnum::SPADES); in TEST()
63 EXPECT_EQ(Bitfield::get<Value>(Storage), 31U); in TEST()
64 EXPECT_EQ(Bitfield::get<SignedValue>(Storage), -1); in TEST()
69 using FirstBit = Bitfield::Element<bool, 0, 1>; in TEST()
71 Bitfield::set<FirstBit>(Storage, true); in TEST()
72 EXPECT_EQ(Bitfield::get<FirstBit>(Storage), true); in TEST()
75 Bitfield::set<FirstBit>(Storage, false); in TEST()
76 EXPECT_EQ(Bitfield::get<FirstBit>(Storage), false); in TEST()
82 using SecondBit = Bitfield::Element<bool, 1, 1>; in TEST()
84 Bitfield::set<SecondBit>(Storage, true); in TEST()
85 EXPECT_EQ(Bitfield::get<SecondBit>(Storage), true); in TEST()
88 Bitfield::set<SecondBit>(Storage, false); in TEST()
89 EXPECT_EQ(Bitfield::get<SecondBit>(Storage), false); in TEST()
95 using LastBit = Bitfield::Element<bool, 7, 1>; in TEST()
97 Bitfield::set<LastBit>(Storage, true); in TEST()
98 EXPECT_EQ(Bitfield::get<LastBit>(Storage), true); in TEST()
101 Bitfield::set<LastBit>(Storage, false); in TEST()
102 EXPECT_EQ(Bitfield::get<LastBit>(Storage), false); in TEST()
108 using LastBit = Bitfield::Element<bool, 63, 1>; in TEST()
110 Bitfield::set<LastBit>(Storage, true); in TEST()
111 EXPECT_EQ(Bitfield::get<LastBit>(Storage), true); in TEST()
114 Bitfield::set<LastBit>(Storage, false); in TEST()
115 EXPECT_EQ(Bitfield::get<LastBit>(Storage), false); in TEST()
123 using OrderingField = Bitfield::Element<Enum, 1, 2, LAST>; in TEST()
124 EXPECT_EQ(Bitfield::get<OrderingField>(Storage), Zero); in TEST()
125 Bitfield::set<OrderingField>(Storage, Two); in TEST()
126 EXPECT_EQ(Bitfield::get<OrderingField>(Storage), Two); in TEST()
135 using OrderingField = Bitfield::Element<Enum, 1, 2, Enum::LAST>; in TEST()
136 EXPECT_EQ(Bitfield::get<OrderingField>(Storage), Enum::Zero); in TEST()
137 Bitfield::set<OrderingField>(Storage, Enum::Two); in TEST()
138 EXPECT_EQ(Bitfield::get<OrderingField>(Storage), Enum::Two); in TEST()
145 using SignedField = Bitfield::Element<int, 1, 1>; in TEST()
146 EXPECT_EQ(Bitfield::get<SignedField>(Storage), 0); in TEST()
149 Bitfield::set<SignedField>(Storage, -1); in TEST()
150 EXPECT_EQ(Bitfield::get<SignedField>(Storage), -1); in TEST()
157 using SignedField = Bitfield::Element<int, 1, 2>; in TEST()
158 EXPECT_EQ(Bitfield::get<SignedField>(Storage), 0); in TEST()
161 Bitfield::set<SignedField>(Storage, 1); in TEST()
162 EXPECT_EQ(Bitfield::get<SignedField>(Storage), 1); in TEST()
165 Bitfield::set<SignedField>(Storage, -1); in TEST()
166 EXPECT_EQ(Bitfield::get<SignedField>(Storage), -1); in TEST()
169 Bitfield::set<SignedField>(Storage, -2); in TEST()
170 EXPECT_EQ(Bitfield::get<SignedField>(Storage), -2); in TEST()
181 using A = Bitfield::Element<unsigned, 0, 8>; in TEST()
182 using B = Bitfield::Element<unsigned, 3, 3>; in TEST()
183 using C = Bitfield::Element<unsigned, 1, 3>; in TEST()
184 using D = Bitfield::Element<unsigned, 4, 3>; in TEST()
185 EXPECT_TRUE((Bitfield::isOverlapping<A, B>())); in TEST()
186 EXPECT_TRUE((Bitfield::isOverlapping<A, C>())); in TEST()
187 EXPECT_TRUE((Bitfield::isOverlapping<A, B>())); in TEST()
188 EXPECT_TRUE((Bitfield::isOverlapping<A, D>())); in TEST()
190 EXPECT_TRUE((Bitfield::isOverlapping<B, C>())); in TEST()
191 EXPECT_TRUE((Bitfield::isOverlapping<B, D>())); in TEST()
192 EXPECT_FALSE((Bitfield::isOverlapping<C, D>())); in TEST()
196 using A = Bitfield::Element<unsigned, 0, 1>; // Next Bit:1 in TEST()
197 using B = Bitfield::Element<unsigned, 1, 4>; // Next Bit:5 in TEST()
198 using C = Bitfield::Element<unsigned, 5, 3>; // Next Bit:8 in TEST()
199 EXPECT_TRUE((Bitfield::areContiguous<A, B>())); in TEST()
200 EXPECT_TRUE((Bitfield::areContiguous<A, B, C>())); in TEST()
202 EXPECT_FALSE((Bitfield::areContiguous<A, C>())); in TEST()
203 EXPECT_FALSE((Bitfield::areContiguous<A, A>())); in TEST()
204 EXPECT_FALSE((Bitfield::areContiguous<B, A>())); in TEST()
209 using Value = Bitfield::Element<uint64_t, 0, 64>; in TEST()
210 Bitfield::set<Value>(Storage, -1ULL); in TEST()
211 EXPECT_EQ(Bitfield::get<Value>(Storage), -1ULL); in TEST()
212 Bitfield::set<Value>(Storage, 0ULL); in TEST()
213 EXPECT_EQ(Bitfield::get<Value>(Storage), 0ULL); in TEST()
218 using Value = Bitfield::Element<int64_t, 0, 64>; in TEST()
219 Bitfield::set<Value>(Storage, -1); in TEST()
220 EXPECT_EQ(Bitfield::get<Value>(Storage), -1); in TEST()
221 Bitfield::set<Value>(Storage, 0); in TEST()
222 EXPECT_EQ(Bitfield::get<Value>(Storage), 0); in TEST()
229 using A = Bitfield::Element<unsigned, 0, 1>; in TEST()
230 Bitfield::set<A>(Storage, true); in TEST()
231 Bitfield::set<A>(Storage, false); in TEST()
232 EXPECT_DEBUG_DEATH(Bitfield::set<A>(Storage, 2), "value is too big"); in TEST()
237 using A = Bitfield::Element<unsigned, 0, 2>; in TEST()
238 Bitfield::set<A>(Storage, 3); in TEST()
239 EXPECT_DEBUG_DEATH(Bitfield::set<A>(Storage, 4), "value is too big"); in TEST()
240 EXPECT_DEBUG_DEATH(Bitfield::set<A>(Storage, -1), "value is too big"); in TEST()
245 using A = Bitfield::Element<int, 1, 2>; in TEST()
246 Bitfield::set<A>(Storage, 1); in TEST()
247 Bitfield::set<A>(Storage, 0); in TEST()
248 Bitfield::set<A>(Storage, -1); in TEST()
249 Bitfield::set<A>(Storage, -2); in TEST()
250 EXPECT_DEBUG_DEATH(Bitfield::set<A>(Storage, 2), "value is too big"); in TEST()
251 EXPECT_DEBUG_DEATH(Bitfield::set<A>(Storage, -3), "value is too small"); in TEST()