Esempio n. 1
0
 public function testSimpleLoop()
 {
     $Loop = new Loop(new Object(array(Object::TIME => array(0, 1, 2, 3, 4, 5))));
     $i = 0;
     while ($Loop->nextStep()) {
         $i++;
         $this->assertEquals($i, $Loop->time());
     }
     $this->assertTrue($Loop->isAtEnd());
 }
Esempio n. 2
0
 public function testSwimdataLoop()
 {
     $Loop = new Loop(new Object(array(Object::STROKE => array(25, 20, 15, 20), Object::STROKETYPE => array(2, 2, 2, 2))));
     $Loop->nextStep();
     $this->assertEquals(20, $Loop->stroke());
     $this->assertEquals(2, $Loop->stroketype());
     $Loop->setStepSize(2);
     $Loop->nextStep();
     $this->assertEquals(20, $Loop->stroke());
     $this->assertEquals(2, $Loop->stroketype());
     $Loop->nextStep();
     $this->assertTrue($Loop->isAtEnd());
 }
Esempio n. 3
0
 public function testRouteLoop()
 {
     $Loop = new Loop(new Object(array(Object::LATITUDES => array(47.7, 47.8, 47.9, 47.8, 47.7), Object::LONGITUDES => array(7.7, 7.8, 7.9, 7.8, 7.7))));
     $Loop->nextStep();
     $this->assertEquals(47.8, $Loop->latitude());
     $this->assertEquals(7.8, $Loop->longitude());
     $this->assertEquals(13.41, $Loop->calculatedStepDistance(), '', 0.2);
     $Loop->setStepSize(2);
     $Loop->nextStep();
     $this->assertEquals(47.8, $Loop->latitude());
     $this->assertEquals(7.8, $Loop->longitude());
     $this->assertEquals(0.0, $Loop->calculatedStepDistance());
     $Loop->nextStep();
     $this->assertTrue($Loop->isAtEnd());
 }