diff options
-rw-r--r-- | pts-core/functions/pts-functions-run.php | 4 | ||||
-rw-r--r-- | pts-core/objects/pts_test_result.php | 14 | ||||
-rw-r--r-- | pts-core/options/run_test.php | 11 |
3 files changed, 20 insertions, 9 deletions
diff --git a/pts-core/functions/pts-functions-run.php b/pts-core/functions/pts-functions-run.php index b6cb116..685cafa 100644 --- a/pts-core/functions/pts-functions-run.php +++ b/pts-core/functions/pts-functions-run.php @@ -333,6 +333,10 @@ function pts_prompt_save_file_name($check_env = true, $to_run) echo "\n\nThe name of the saved file cannot be the same as a test/suite: " . $PROPOSED_FILE_NAME . "\n"; $is_reserved_word = false; } + else if(!pts_validate_save_file_name($PROPOSED_FILE_NAME, $to_run)) + { + echo "\n\n" . $PROPOSED_FILE_NAME . " is associated with a different test/suite.\n"; + } echo "Enter a name to save these results: "; $PROPOSED_FILE_NAME = trim(fgets(STDIN)); diff --git a/pts-core/objects/pts_test_result.php b/pts-core/objects/pts_test_result.php index adcc3b9..2bc5b86 100644 --- a/pts-core/objects/pts_test_result.php +++ b/pts-core/objects/pts_test_result.php @@ -192,15 +192,21 @@ class pts_test_result { // assume AVG (average) $TOTAL_RESULT = 0; + $TOTAL_COUNT = 0; + foreach($this->trial_results as $result) { - $TOTAL_RESULT += trim($result); - $return_string .= $result . " " . $this->result_scale . "\n"; + if(is_numeric($result)) + { + $TOTAL_RESULT += trim($result); + $TOTAL_COUNT++; + $return_string .= $result . " " . $this->result_scale . "\n"; + } } - if(count($this->trial_results) > 0) + if($TOTAL_COUNT > 0) { - $END_RESULT = pts_trim_double($TOTAL_RESULT / count($this->trial_results), 2); + $END_RESULT = pts_trim_double($TOTAL_RESULT / $TOTAL_COUNT, 2); } else { diff --git a/pts-core/options/run_test.php b/pts-core/options/run_test.php index 8cff4ec..5b80c2a 100644 --- a/pts-core/options/run_test.php +++ b/pts-core/options/run_test.php @@ -43,7 +43,8 @@ class run_test implements pts_option_interface return false; } - for($i = 0; $i < count($to_run_identifiers); $i++) + $start_identifier_count = count($to_run_identifiers); + for($i = 0; $i < $start_identifier_count; $i++) { // Clean up tests $lower_identifier = strtolower($to_run_identifiers[$i]); @@ -57,7 +58,7 @@ class run_test implements pts_option_interface { echo pts_string_header($lower_identifier . " is not a test."); unset($to_run_identifiers[$i]); - break; + continue; } } @@ -65,7 +66,7 @@ class run_test implements pts_option_interface { // Eliminate this test, it's not properly installed unset($to_run_identifiers[$i]); - break; + continue; } if(is_file($to_run_identifiers[$i]) && substr(basename($to_run_identifiers[$i]), -4) == ".svg") @@ -114,7 +115,7 @@ class run_test implements pts_option_interface else { echo pts_string_header("Not Recognized: " . $to_run); - break; + continue; } pts_set_assignment_once("AUTO_SAVE_NAME", $to_run); @@ -233,7 +234,7 @@ class run_test implements pts_option_interface else { echo pts_string_header("\nUnrecognized option: " . $to_run . "\n"); - break; + continue; } for($i = 0; $i < count($TEST_ARGS) && $i < count($TEST_RUN); $i++) |