예제 #1
0
 /**
  * @see http://fellrnr.com/wiki/TRIMP#Worked_Example
  */
 public function testReferenceExample()
 {
     $Male = new Gender();
     $Male->set(Gender::MALE);
     // Fellrnr's example is with HRrest (max = 200, rest = 40, avg = 130)
     // Since we're using HRmax, we have to adapt the data
     $Trimp = new InverseCalculator(new Athlete($Male, 160, 0), 90, 32);
     $this->assertEquals(30 * 60, $Trimp->value(), '', 0.01 * 30 * 60);
 }
예제 #2
0
파일: Factor.php 프로젝트: rob-st/Runalyze
 /**
  * Exponent factor
  * @return float
  */
 public function B()
 {
     if ($this->Gender->isMale()) {
         return 1.92;
     } elseif ($this->Gender->isFemale()) {
         return 1.67;
     } else {
         return 1.795;
     }
 }
예제 #3
0
 public function testAllProperties()
 {
     $Gender = new Gender();
     $Gender->set(Gender::MALE);
     $Athlete = new Athlete($Gender, 210, 45, 70, 25, 60);
     $this->assertTrue($Athlete->knowsGender());
     $this->assertTrue($Athlete->knowsMaximalHeartRate());
     $this->assertTrue($Athlete->knowsRestingHeartRate());
     $this->assertTrue($Athlete->knowsAge());
     $this->assertTrue($Athlete->knowsWeight());
     $this->assertTrue($Athlete->knowsVDOT());
     $this->assertEquals($Gender, $Athlete->gender());
     $this->assertEquals(210, $Athlete->maximalHR());
     $this->assertEquals(45, $Athlete->restingHR());
     $this->assertEquals(70, $Athlete->weight());
     $this->assertEquals(25, $Athlete->age());
     $this->assertEquals(60, $Athlete->vdot());
 }
예제 #4
0
 /**
  * Knows gender
  * @return bool
  */
 public function knowsGender()
 {
     return $this->Gender->hasGender();
 }
예제 #5
0
 /**
  * @see http://fellrnr.com/wiki/TRIMP#Worked_Example
  */
 public function testReferenceExample()
 {
     $Male = new Gender();
     $Male->set(Gender::MALE);
     $Trimp = new Calculator(new Athlete($Male, 200, 40), array(130 => 30 * 60));
     $this->assertEquals(32, $Trimp->value(), '', 0.01 * 32);
 }
예제 #6
0
 public function testHasGender()
 {
     $this->assertFalse($this->object->hasGender());
     $this->assertFalse($this->object->isMale());
     $this->assertFalse($this->object->isFemale());
     $this->object->set(Gender::MALE);
     $this->assertTrue($this->object->hasGender());
     $this->assertTrue($this->object->isMale());
     $this->assertFalse($this->object->isFemale());
     $this->object->set(Gender::FEMALE);
     $this->assertTrue($this->object->hasGender());
     $this->assertFalse($this->object->isMale());
     $this->assertTrue($this->object->isFemale());
 }