File tree Expand file tree Collapse file tree 3 files changed +24
-3
lines changed Expand file tree Collapse file tree 3 files changed +24
-3
lines changed Original file line number Diff line number Diff line change @@ -449,7 +449,7 @@ public function setBinaryBitsetLe($bitset)
449
449
if ($ lastByteMaxOrd === 0 ) {
450
450
$ this ->bitset = $ bitset ;
451
451
} else {
452
- $ lastByte = chr ($ lastByteMaxOrd ) & $ bitset [$ size - 1 ];
452
+ $ lastByte = chr (( 1 << $ lastByteMaxOrd) - 1 ) & $ bitset [$ size - 1 ];
453
453
$ this ->bitset = substr ($ bitset , 0 , -1 ) . $ lastByte ;
454
454
}
455
455
Original file line number Diff line number Diff line change 9
9
use MabeEnumTest \TestAsset \Enum32 ;
10
10
use MabeEnumTest \TestAsset \Enum64 ;
11
11
use MabeEnumTest \TestAsset \Enum65 ;
12
+ use MabeEnumTest \TestAsset \Enum66 ;
12
13
use PHPUnit_Framework_TestCase as TestCase ;
13
14
14
15
/**
@@ -370,8 +371,11 @@ public function testSetBinaryBitsetLe()
370
371
371
372
public function testSetBinaryBitsetLeTruncateHighBits ()
372
373
{
373
- $ enumSet = new EnumSet ('MabeEnumTest\TestAsset\Enum65 ' );
374
- foreach (Enum65::getEnumerators () as $ enumerator ) {
374
+ // using Enum66 to make sure the max. ordinal number gets converted into a bitset
375
+ // Enum65 has max. ordinal number of 1 of the last byte. -> 00000001
376
+ // Enum66 has max. ordinal number of 2 of the last byte. -> 00000011
377
+ $ enumSet = new EnumSet ('MabeEnumTest\TestAsset\Enum66 ' );
378
+ foreach (Enum66::getEnumerators () as $ enumerator ) {
375
379
$ enumSet ->attach ($ enumerator );
376
380
}
377
381
Original file line number Diff line number Diff line change
1
+ <?php
2
+
3
+ namespace MabeEnumTest \TestAsset ;
4
+
5
+ use MabeEnum \Enum ;
6
+
7
+ /**
8
+ * Unit tests for the class MabeEnum\Enum
9
+ *
10
+ * @link http://github.com/marc-mabe/php-enum for the canonical source repository
11
+ * @copyright Copyright (c) 2013 Marc Bennewitz
12
+ * @license http://github.com/marc-mabe/php-enum/blob/master/LICENSE.txt New BSD License
13
+ */
14
+ class Enum66 extends Enum65
15
+ {
16
+ const SIXTYSIX = 66 ;
17
+ }
You can’t perform that action at this time.
0 commit comments