<?php include dirname(__FILE__) . '/../bootstrap/Doctrine.php'; include dirname(__FILE__) . '/../../lib/test/chartSourceUtilityTest.class.php'; $file = dirname(__FILE__) . '/results/chartTripPerYearResults.yml'; $ut = new chartSourceUtilityTest(new sfBrowser()); $t = new lime_test(144, new lime_output_color()); $scenarios = $ut->getBaseScenarios(); $params = array('full_history' => false); //foreach ($scenarios as $key => $scenario) { for ($index = 0; $index < 16; $index++) { $scenario = $scenarios[$index]; $x = getXForScenario($ut, $scenario, $file); $y = getYForScenario($ut, $scenario, $file); $options = array('unit' => 'year', 'range_type' => $scenario[2]); $ut->runTest($t, $scenario, 'buildTripChartData', $x, $y, $options, $params); } function getYForScenario($ut, $scenario, $file) { $yaml = sfYaml::load($file); $case = $ut->getCase($scenario[0], $scenario[1]); $range = $scenario[2]; $limit = isset($scenario[3]) ? 'bounded' : 'unbounded'; if ($case == 2 || $case == 4) { return false; } $y = $yaml['y'][$case][$range][$limit]; return $y; } function getXForScenario($ut, $scenario, $file) {
<?php include dirname(__FILE__) . '/../bootstrap/Doctrine.php'; include dirname(__FILE__) . '/../../lib/test/chartSourceUtilityTest.class.php'; $ut = new chartSourceUtilityTest(new sfBrowser()); $t = new lime_test(136, new lime_output_color()); $scenarios = $ut->getBaseScenarios(); $options = array('categories' => getCategories(), 'vehicles' => getVehicles($ut->getUserId('user_gs')), 'user_id' => $ut->getUserId('user_gs')); $params = array('full_history' => false); //foreach ($scenarios as $key => $scenario) { for ($index = 0; $index < 16; $index++) { $scenario = $scenarios[$index]; $y = getYForScenario($ut, $scenario); $x = getXForScenario($ut, $scenario); $fname = 'buildCostPieChartData'; $options = array_merge($options, array('vehicle_display' => $scenario[0])); $g = $ut->runTest($t, $scenario, $fname, $x, $y, $options, $params); } function getYForScenario($ut, $scenario) { $case = $ut->getCase($scenario[0], $scenario[1]); $range = $scenario[2]; $limit = isset($scenario[3]) ? true : false; // categories // [0] => Fuel // [1] => Initial investment // [2] => Leasing // [3] => Tax // [4] => Accessory // [5] => Insurance // [6] => Fine
<?php include dirname(__FILE__) . '/../bootstrap/Doctrine.php'; include dirname(__FILE__) . '/../../lib/test/chartSourceUtilityTest.class.php'; $ut = new chartSourceUtilityTest(new sfBrowser()); $t = new lime_test(272, new lime_output_color()); $file = dirname(__FILE__) . '/results/chartConsumptionPerDistanceResults.yml'; $scenarios = $ut->getBaseScenarios(); $params = array('categories_names' => array('Fuel'), 'full_history' => true); for ($index = 0; $index < 16; $index++) { $scenario = $scenarios[$index]; $options = $scenario[2]; $y = getYForScenario($ut, $scenario, $file); $x = getXForScenario($ut, $scenario, $file); $fname = 'buildConsumptionPerDistanceChartData'; $g = $ut->runTest($t, $scenario, $fname, $x, $y, $options, $params); } function getYForScenario($ut, $scenario, $file) { $yaml = sfYaml::load($file); $case = $ut->getCase($scenario[0], $scenario[1]); $range = $scenario[2]; $limit = isset($scenario[3]) ? 'bounded' : 'unbounded'; $x = $yaml['y']['x'][$case][$limit][$range]; $y = $yaml['y'][$case][$limit][$range]; //print_r($x); //print_r($y); foreach ($y as $ykey => $serie) { $x_first = $yaml['y']['x'][$case]['first'][$range][$ykey]; foreach ($serie as $skey => $value) { $dist = $x[$skey] - $x_first;