@@ 254-286 (lines=33) @@ | ||
251 | $this->assertTrue($enum->valid()); |
|
252 | } |
|
253 | ||
254 | public function testGetBinaryBitsetBe() |
|
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("\x00\x00\x00\x00\x00\x00\x00\x00\x01", $enumSet->getBinaryBitsetBe()); |
|
265 | $this->assertTrue($enumSet->contains($enum1)); |
|
266 | ||
267 | $this->assertNull($enumSet->attach($enum2)); |
|
268 | $this->assertSame('000000000000000003', \bin2hex($enumSet->getBinaryBitsetBe())); |
|
269 | $this->assertTrue($enumSet->contains($enum2)); |
|
270 | ||
271 | $this->assertNull($enumSet->attach($enum3)); |
|
272 | $this->assertSame("\x01\x00\x00\x00\x00\x00\x00\x00\x03", $enumSet->getBinaryBitsetBe()); |
|
273 | $this->assertTrue($enumSet->contains($enum3)); |
|
274 | ||
275 | $this->assertNull($enumSet->attach($enum4)); |
|
276 | $this->assertSame("\x01\x80\x00\x00\x00\x00\x00\x00\x03", $enumSet->getBinaryBitsetBe()); |
|
277 | $this->assertTrue($enumSet->contains($enum4)); |
|
278 | ||
279 | $this->assertSame(4, $enumSet->count()); |
|
280 | ||
281 | $this->assertNull($enumSet->detach($enum2)); |
|
282 | $this->assertSame("\x01\x80\x00\x00\x00\x00\x00\x00\x01", $enumSet->getBinaryBitsetBe()); |
|
283 | $this->assertFalse($enumSet->contains($enum2)); |
|
284 | ||
285 | $this->assertSame(3, $enumSet->count()); |
|
286 | } |
|
287 | ||
288 | /** |
|
289 | * @deprecated |
|
@@ 291-323 (lines=33) @@ | ||
288 | /** |
|
289 | * @deprecated |
|
290 | */ |
|
291 | public function testGetBitset() |
|
292 | { |
|
293 | $enumSet = new EnumSet('MabeEnumTest\TestAsset\Enum65'); |
|
294 | ||
295 | $enum1 = Enum65::ONE; |
|
296 | $enum2 = Enum65::TWO; |
|
297 | $enum3 = Enum65::SIXTYFIVE; |
|
298 | $enum4 = Enum65::SIXTYFOUR; |
|
299 | ||
300 | $this->assertNull($enumSet->attach($enum1)); |
|
301 | $this->assertSame("\x00\x00\x00\x00\x00\x00\x00\x00\x01", $enumSet->getBitset()); |
|
302 | $this->assertTrue($enumSet->contains($enum1)); |
|
303 | ||
304 | $this->assertNull($enumSet->attach($enum2)); |
|
305 | $this->assertSame('000000000000000003', \bin2hex($enumSet->getBitset())); |
|
306 | $this->assertTrue($enumSet->contains($enum2)); |
|
307 | ||
308 | $this->assertNull($enumSet->attach($enum3)); |
|
309 | $this->assertSame("\x01\x00\x00\x00\x00\x00\x00\x00\x03", $enumSet->getBitset()); |
|
310 | $this->assertTrue($enumSet->contains($enum3)); |
|
311 | ||
312 | $this->assertNull($enumSet->attach($enum4)); |
|
313 | $this->assertSame("\x01\x80\x00\x00\x00\x00\x00\x00\x03", $enumSet->getBitset()); |
|
314 | $this->assertTrue($enumSet->contains($enum4)); |
|
315 | ||
316 | $this->assertSame(4, $enumSet->count()); |
|
317 | ||
318 | $this->assertNull($enumSet->detach($enum2)); |
|
319 | $this->assertSame("\x01\x80\x00\x00\x00\x00\x00\x00\x01", $enumSet->getBitset()); |
|
320 | $this->assertFalse($enumSet->contains($enum2)); |
|
321 | ||
322 | $this->assertSame(3, $enumSet->count()); |
|
323 | } |
|
324 | ||
325 | public function testSetBinaryBitsetBe() |
|
326 | { |