@@ 250-282 (lines=33) @@ | ||
247 | $this->assertTrue($enum->valid()); |
|
248 | } |
|
249 | ||
250 | public function testGetBinaryBitsetLe() |
|
251 | { |
|
252 | $enumSet = new EnumSet(Enum65::class); |
|
253 | ||
254 | $enum1 = Enum65::ONE; |
|
255 | $enum2 = Enum65::TWO; |
|
256 | $enum3 = Enum65::SIXTYFIVE; |
|
257 | $enum4 = Enum65::SIXTYFOUR; |
|
258 | ||
259 | $this->assertNull($enumSet->attach($enum1)); |
|
260 | $this->assertSame("\x01\x00\x00\x00\x00\x00\x00\x00\x00", $enumSet->getBinaryBitsetLe()); |
|
261 | $this->assertTrue($enumSet->contains($enum1)); |
|
262 | ||
263 | $this->assertNull($enumSet->attach($enum2)); |
|
264 | $this->assertSame("\x03\x00\x00\x00\x00\x00\x00\x00\x00", $enumSet->getBinaryBitsetLe()); |
|
265 | $this->assertTrue($enumSet->contains($enum2)); |
|
266 | ||
267 | $this->assertNull($enumSet->attach($enum3)); |
|
268 | $this->assertSame("\x03\x00\x00\x00\x00\x00\x00\x00\x01", $enumSet->getBinaryBitsetLe()); |
|
269 | $this->assertTrue($enumSet->contains($enum3)); |
|
270 | ||
271 | $this->assertNull($enumSet->attach($enum4)); |
|
272 | $this->assertSame("\x03\x00\x00\x00\x00\x00\x00\x80\x01", $enumSet->getBinaryBitsetLe()); |
|
273 | $this->assertTrue($enumSet->contains($enum4)); |
|
274 | ||
275 | $this->assertSame(4, $enumSet->count()); |
|
276 | ||
277 | $this->assertNull($enumSet->detach($enum2)); |
|
278 | $this->assertSame("\x01\x00\x00\x00\x00\x00\x00\x80\x01", $enumSet->getBinaryBitsetLe()); |
|
279 | $this->assertFalse($enumSet->contains($enum2)); |
|
280 | ||
281 | $this->assertSame(3, $enumSet->count()); |
|
282 | } |
|
283 | ||
284 | public function testGetBinaryBitsetBe() |
|
285 | { |
|
@@ 284-316 (lines=33) @@ | ||
281 | $this->assertSame(3, $enumSet->count()); |
|
282 | } |
|
283 | ||
284 | public function testGetBinaryBitsetBe() |
|
285 | { |
|
286 | $enumSet = new EnumSet(Enum65::class); |
|
287 | ||
288 | $enum1 = Enum65::ONE; |
|
289 | $enum2 = Enum65::TWO; |
|
290 | $enum3 = Enum65::SIXTYFIVE; |
|
291 | $enum4 = Enum65::SIXTYFOUR; |
|
292 | ||
293 | $this->assertNull($enumSet->attach($enum1)); |
|
294 | $this->assertSame("\x00\x00\x00\x00\x00\x00\x00\x00\x01", $enumSet->getBinaryBitsetBe()); |
|
295 | $this->assertTrue($enumSet->contains($enum1)); |
|
296 | ||
297 | $this->assertNull($enumSet->attach($enum2)); |
|
298 | $this->assertSame("\x00\x00\x00\x00\x00\x00\x00\x00\x03", $enumSet->getBinaryBitsetBe()); |
|
299 | $this->assertTrue($enumSet->contains($enum2)); |
|
300 | ||
301 | $this->assertNull($enumSet->attach($enum3)); |
|
302 | $this->assertSame("\x01\x00\x00\x00\x00\x00\x00\x00\x03", $enumSet->getBinaryBitsetBe()); |
|
303 | $this->assertTrue($enumSet->contains($enum3)); |
|
304 | ||
305 | $this->assertNull($enumSet->attach($enum4)); |
|
306 | $this->assertSame("\x01\x80\x00\x00\x00\x00\x00\x00\x03", $enumSet->getBinaryBitsetBe()); |
|
307 | $this->assertTrue($enumSet->contains($enum4)); |
|
308 | ||
309 | $this->assertSame(4, $enumSet->count()); |
|
310 | ||
311 | $this->assertNull($enumSet->detach($enum2)); |
|
312 | $this->assertSame("\x01\x80\x00\x00\x00\x00\x00\x00\x01", $enumSet->getBinaryBitsetBe()); |
|
313 | $this->assertFalse($enumSet->contains($enum2)); |
|
314 | ||
315 | $this->assertSame(3, $enumSet->count()); |
|
316 | } |
|
317 | ||
318 | public function testSetBinaryBitsetLe() |
|
319 | { |