Exemplo n.º 1
0
 public function testCalculationFromCorrectedData()
 {
     $Route = new Route\Object(array(Route\Object::ELEVATIONS_ORIGINAL => array(100, 100, 100, 100), Route\Object::ELEVATIONS_CORRECTED => array(100, 120, 150, 140)));
     $Calc = new Calculator($Route);
     $Calc->calculateElevation();
     $this->assertGreaterThan(0, $Route->elevation());
     $this->assertGreaterThan(0, $Route->elevationUp());
     $this->assertGreaterThan(0, $Route->elevationDown());
 }
Exemplo n.º 2
0
 /**
  * Calculate VDOT by heart rate with elevation influence
  * @return float
  */
 public function calculateVDOTbyHeartRateWithElevation()
 {
     if ($this->knowsRoute()) {
         if ($this->Route->elevationUp() > 0 || $this->Route->elevationDown() > 0) {
             return $this->calculateVDOTbyHeartRateWithElevationFor($this->Route->elevationUp(), $this->Route->elevationDown());
         }
         return $this->calculateVDOTbyHeartRateWithElevationFor($this->Route->elevation(), $this->Route->elevation());
     }
     return $this->calculateVDOTbyHeartRateWithElevationFor($this->Activity->elevation(), $this->Activity->elevation());
 }
Exemplo n.º 3
0
 public function testElevationCalculation()
 {
     $R = new Object(array(Object::ELEVATIONS_CORRECTED => array(100, 120, 110)));
     $I = new Inserter($this->PDO, $R);
     $I->setAccountID(0);
     $I->insert();
     $data = $this->PDO->query('SELECT * FROM `' . PREFIX . 'route` WHERE `accountid`=0')->fetch(PDO::FETCH_ASSOC);
     $N = new Object($data);
     $this->assertGreaterThan(0, $N->elevation());
     $this->assertGreaterThan(0, $N->elevationUp());
     $this->assertGreaterThan(0, $N->elevationDown());
 }