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