@@ 254-286 (lines=33) @@ | ||
251 | $this->assertTrue($enum->valid()); |
|
252 | } |
|
253 | ||
254 | public function testGetBinaryBitsetLe() |
|
255 | { |
|
256 | $enumSet = new EnumSet('MabeEnumTest\TestAsset\Enum65'); |
|
257 | ||
258 | $enum1 = Enum65::ONE; |
|
259 | $enum2 = Enum65::TWO; |
|
260 | $enum3 = Enum65::SIXTYFIVE; |
|
261 | $enum4 = Enum65::SIXTYFOUR; |
|
262 | ||
263 | $this->assertNull($enumSet->attach($enum1)); |
|
264 | $this->assertSame("\x01\x00\x00\x00\x00\x00\x00\x00\x00", $enumSet->getBinaryBitsetLe()); |
|
265 | $this->assertTrue($enumSet->contains($enum1)); |
|
266 | ||
267 | $this->assertNull($enumSet->attach($enum2)); |
|
268 | $this->assertSame("\x03\x00\x00\x00\x00\x00\x00\x00\x00", $enumSet->getBinaryBitsetLe()); |
|
269 | $this->assertTrue($enumSet->contains($enum2)); |
|
270 | ||
271 | $this->assertNull($enumSet->attach($enum3)); |
|
272 | $this->assertSame("\x03\x00\x00\x00\x00\x00\x00\x00\x01", $enumSet->getBinaryBitsetLe()); |
|
273 | $this->assertTrue($enumSet->contains($enum3)); |
|
274 | ||
275 | $this->assertNull($enumSet->attach($enum4)); |
|
276 | $this->assertSame("\x03\x00\x00\x00\x00\x00\x00\x80\x01", $enumSet->getBinaryBitsetLe()); |
|
277 | $this->assertTrue($enumSet->contains($enum4)); |
|
278 | ||
279 | $this->assertSame(4, $enumSet->count()); |
|
280 | ||
281 | $this->assertNull($enumSet->detach($enum2)); |
|
282 | $this->assertSame("\x01\x00\x00\x00\x00\x00\x00\x80\x01", $enumSet->getBinaryBitsetLe()); |
|
283 | $this->assertFalse($enumSet->contains($enum2)); |
|
284 | ||
285 | $this->assertSame(3, $enumSet->count()); |
|
286 | } |
|
287 | ||
288 | public function testGetBinaryBitsetBe() |
|
289 | { |
|
@@ 288-320 (lines=33) @@ | ||
285 | $this->assertSame(3, $enumSet->count()); |
|
286 | } |
|
287 | ||
288 | public function testGetBinaryBitsetBe() |
|
289 | { |
|
290 | $enumSet = new EnumSet('MabeEnumTest\TestAsset\Enum65'); |
|
291 | ||
292 | $enum1 = Enum65::ONE; |
|
293 | $enum2 = Enum65::TWO; |
|
294 | $enum3 = Enum65::SIXTYFIVE; |
|
295 | $enum4 = Enum65::SIXTYFOUR; |
|
296 | ||
297 | $this->assertNull($enumSet->attach($enum1)); |
|
298 | $this->assertSame("\x00\x00\x00\x00\x00\x00\x00\x00\x01", $enumSet->getBinaryBitsetBe()); |
|
299 | $this->assertTrue($enumSet->contains($enum1)); |
|
300 | ||
301 | $this->assertNull($enumSet->attach($enum2)); |
|
302 | $this->assertSame("\x00\x00\x00\x00\x00\x00\x00\x00\x03", $enumSet->getBinaryBitsetBe()); |
|
303 | $this->assertTrue($enumSet->contains($enum2)); |
|
304 | ||
305 | $this->assertNull($enumSet->attach($enum3)); |
|
306 | $this->assertSame("\x01\x00\x00\x00\x00\x00\x00\x00\x03", $enumSet->getBinaryBitsetBe()); |
|
307 | $this->assertTrue($enumSet->contains($enum3)); |
|
308 | ||
309 | $this->assertNull($enumSet->attach($enum4)); |
|
310 | $this->assertSame("\x01\x80\x00\x00\x00\x00\x00\x00\x03", $enumSet->getBinaryBitsetBe()); |
|
311 | $this->assertTrue($enumSet->contains($enum4)); |
|
312 | ||
313 | $this->assertSame(4, $enumSet->count()); |
|
314 | ||
315 | $this->assertNull($enumSet->detach($enum2)); |
|
316 | $this->assertSame("\x01\x80\x00\x00\x00\x00\x00\x00\x01", $enumSet->getBinaryBitsetBe()); |
|
317 | $this->assertFalse($enumSet->contains($enum2)); |
|
318 | ||
319 | $this->assertSame(3, $enumSet->count()); |
|
320 | } |
|
321 | ||
322 | /** |
|
323 | * @deprecated |
|
@@ 325-357 (lines=33) @@ | ||
322 | /** |
|
323 | * @deprecated |
|
324 | */ |
|
325 | public function testGetBitset() |
|
326 | { |
|
327 | $enumSet = new EnumSet('MabeEnumTest\TestAsset\Enum65'); |
|
328 | ||
329 | $enum1 = Enum65::ONE; |
|
330 | $enum2 = Enum65::TWO; |
|
331 | $enum3 = Enum65::SIXTYFIVE; |
|
332 | $enum4 = Enum65::SIXTYFOUR; |
|
333 | ||
334 | $this->assertNull($enumSet->attach($enum1)); |
|
335 | $this->assertSame("\x00\x00\x00\x00\x00\x00\x00\x00\x01", $enumSet->getBitset()); |
|
336 | $this->assertTrue($enumSet->contains($enum1)); |
|
337 | ||
338 | $this->assertNull($enumSet->attach($enum2)); |
|
339 | $this->assertSame("\x00\x00\x00\x00\x00\x00\x00\x00\x03", $enumSet->getBitset()); |
|
340 | $this->assertTrue($enumSet->contains($enum2)); |
|
341 | ||
342 | $this->assertNull($enumSet->attach($enum3)); |
|
343 | $this->assertSame("\x01\x00\x00\x00\x00\x00\x00\x00\x03", $enumSet->getBitset()); |
|
344 | $this->assertTrue($enumSet->contains($enum3)); |
|
345 | ||
346 | $this->assertNull($enumSet->attach($enum4)); |
|
347 | $this->assertSame("\x01\x80\x00\x00\x00\x00\x00\x00\x03", $enumSet->getBitset()); |
|
348 | $this->assertTrue($enumSet->contains($enum4)); |
|
349 | ||
350 | $this->assertSame(4, $enumSet->count()); |
|
351 | ||
352 | $this->assertNull($enumSet->detach($enum2)); |
|
353 | $this->assertSame("\x01\x80\x00\x00\x00\x00\x00\x00\x01", $enumSet->getBitset()); |
|
354 | $this->assertFalse($enumSet->contains($enum2)); |
|
355 | ||
356 | $this->assertSame(3, $enumSet->count()); |
|
357 | } |
|
358 | ||
359 | public function testSetBinaryBitsetLe() |
|
360 | { |