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