foreach ($methods as $method) { $pass &= method_exists($class, $method); echo pass_fail('----- ' . $class . '->' . $method . '() exists' . PHP_EOL, $pass); } echo PHP_EOL; } if (!$pass) { die('Extension elements don\'t work :(' . PHP_EOL); } $coordinate_1 = new coordinate(52.3033, -0.79195, 1); $coordinate_2 = new coordinate(52.296616666666665, -0.6392833333333333, 3); $coordinate_3 = new coordinate(52.19661, -0.62928333, 3, 19); $set = new coordinate_set(2); $set->set($coordinate_1); $set->set($coordinate_2); $tests = ['52.3033' => $coordinate_1->lat(), '-0.79195' => $coordinate_1->lng(), '1' => $coordinate_1->ele(), '094.023977' => $coordinate_1->get_bearing_to($coordinate_2), '10.407709313555' => $coordinate_1->get_distance_to($coordinate_2), '10.441137' => $coordinate_1->get_distance_to($coordinate_2, true), '52.3033' => $set->first()->lat(), '-0.6392833333333333' => $set->last()->lng(), '19' => $coordinate_3->timestamp()]; foreach ($tests as $key => $value) { echo pass_fail(sprintf('----> (%010.6f) = %010.6f', $key, $value), round($key, 6) == round($value, 6)) . PHP_EOL; } echo 'Loop test: ' . PHP_EOL; for ($i = 0; $i < $set->count(); $i++) { echo $i . ': ' . $set->get($i)->gridref() . PHP_EOL; } echo pass("Looping successful"); echo PHP_EOL; score_track('igc/1/test.igc', ['OD: 014.50 -> 140,346,642,771,813,', 'OR: 007.88 -> 352,642,771, // GPSDUMP INVALID', 'TR: 009.23 -> 257,345,441,257,']); // score_track('igc/2/test.igc', [ // 'OD: 028.92 -> 3,126,975,1014,1597,', // 'OR: 002.68 -> 892,975,1013, // GPSDUMP INVALID', // 'TR: 002.80 -> 121,293,431,121,' // ]);