Exemplo n.º 1
0
 public function testArray()
 {
     $t = new NativeArray();
     $this->assertSame($t->testArray1(), array());
     $this->assertSame($t->testArray2(), array(1, 2, 3));
     $this->assertSame($t->testArray3(), array(1.1, 2.2, 3.3));
     $this->assertSame($t->testArray4(), array(false, true, false));
     $this->assertSame($t->testArray5(), array(null, null, null));
     $this->assertSame($t->testArray6(), array("x", "y", "z"));
     $this->assertSame($t->testArray7(), array(1, 2, 3));
     $this->assertSame($t->testArray8(), array(1.0, 2.0, 3.0));
     $this->assertSame($t->testArray9(), array(true, false, true));
     $this->assertSame($t->testArray10(), array("hello1", "hello2", "hello3"));
     $this->assertSame($t->testArray11(), array(array(1, 2, 3), array(4, 5, 6)));
     $this->assertSame($t->testArray12(), array(array(array(1, 2, 3))));
     $this->assertSame($t->testArray13(), array(1 => "hello1", 2 => "hello2", 3 => "hello3"));
     $this->assertSame($t->testArray14(), array("hello1" => 1, "hello2" => 2, "hello3" => 3));
     $this->assertSame($t->testArray15(), array("hello1" => true, "hello2" => false, "hello3" => true));
     $this->assertSame($t->testArray16(), array("hello1" => 1.0, "hello2" => 2.0, "hello3" => 3.0));
     $this->assertSame($t->testArray17(), array("hello1" => null, "hello2" => null, "hello3" => null));
     $this->assertSame($t->testArray18(), array("hello1" => "a", "hello2" => "b", "hello3" => "c"));
     $this->assertSame($t->testArray19(), array(0 => true, 1 => false, 2 => true));
     $this->assertSame($t->testArray20(), array(0 => 1.0, 1 => 2.0, 2 => 3.0));
     $this->assertSame($t->testArray21(), array(0 => null, 1 => null, 2 => null));
     $this->assertSame($t->testArray22(), array(0 => 4, 1 => 5, 2 => 6));
     $this->assertSame($t->testArray23(), array(0 => 0, 1 => 0, 2 => 0));
     $this->assertSame($t->testArray24(), array(0 => 0.0, 1 => 0.0, 2 => 0.0));
 }