示例#1
0
 public function testGetRow()
 {
     $matrix = new BitMatrix(102, 5);
     for ($x = 0; $x < 102; $x++) {
         if ($x & 3 === 0) {
             $matrix->set($x, 2);
         }
     }
     $array1 = $matrix->getRow(2, null);
     $this->assertEquals(102, $array1->getSize());
     $array2 = new BitArray(60);
     $array2 = $matrix->getRow(2, $array2);
     $this->assertEquals(102, $array2->getSize());
     $array3 = new BitArray(200);
     $array3 = $matrix->getRow(2, $array3);
     $this->assertEquals(200, $array3->getSize());
     for ($x = 0; $x < 102; $x++) {
         $on = $x & 3 === 0;
         $this->assertEquals($on, $array1->get($x));
         $this->assertEquals($on, $array2->get($x));
         $this->assertEquals($on, $array3->get($x));
     }
 }