function test($name, $data_type, $plot_type, $data, $expected) { global $test_verbose, $n_tests, $n_pass, $n_fail; $n_tests++; $title = "Test case {$n_tests}: {$name}"; if ($test_verbose) { echo "{$title}\n"; } $p = new PHPlot_test(); // See above, for access to protected methods $p->SetDataType($data_type); $p->SetPlotType($plot_type); $p->SetDataValues($data); // For PHPlot>5.1.2 (CVS). FindDataLimits requires this. $p->CALL_CheckDataArray(); // Call internal function: $p->CALL_FindDataLimits(); // Get min,max x,y - cast to float for comparing $results = $p->GET_min_max_x_y(); // Backward compatibility fixup(s): compat_1($p, $data_type, $expected); $error = ''; if (expect_equal($expected, $results, $title, $error)) { $n_pass++; } else { $n_fail++; echo "{$error}\n"; } }