Exemplo n.º 1
0
<?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
Exemplo n.º 2
0
<?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)
{