File tree Expand file tree Collapse file tree 2 files changed +10
-2
lines changed Expand file tree Collapse file tree 2 files changed +10
-2
lines changed Original file line number Diff line number Diff line change @@ -189,11 +189,12 @@ public function count()
189189 {
190190 $ cnt = 0 ;
191191 $ ord = 0 ;
192- do {
192+
193+ while ($ ord !== $ this ->ordinalMax ) {
193194 if ($ this ->getBit ($ ord ++)) {
194195 ++$ cnt ;
195196 }
196- } while ( $ ord !== $ this -> ordinalMax );
197+ }
197198
198199 return $ cnt ;
199200 }
Original file line number Diff line number Diff line change 33namespace MabeEnumTest ;
44
55use MabeEnum \EnumSet ;
6+ use MabeEnumTest \TestAsset \EmptyEnum ;
67use MabeEnumTest \TestAsset \EnumBasic ;
78use MabeEnumTest \TestAsset \EnumInheritance ;
89use MabeEnumTest \TestAsset \Enum32 ;
@@ -317,4 +318,10 @@ public function testFalseBitsetArgumentExceptionIfNotString()
317318 $ enum = new EnumSet ('MabeEnumTest\TestAsset\Enum65 ' );
318319 $ enum ->setBitset (0 );
319320 }
321+
322+ public function testCountingEmptyEnumEmptySet ()
323+ {
324+ $ set = new EnumSet ('MabeEnumTest\TestAsset\EmptyEnum ' );
325+ $ this ->assertSame (0 , $ set ->count ());
326+ }
320327}
You can’t perform that action at this time.
0 commit comments