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