Coalesce all the management of number of failed scenarios.
This commit is contained in:
Kartik K. Agaram 2016-10-20 20:22:12 -07:00
parent dddc384c51
commit eef0251c59
3 changed files with 1 additions and 8 deletions

View File

@ -24,7 +24,6 @@ long Num_failures = 0;
:(before "End Includes")
#define CHECK(X) \
if (Passed && !(X)) { \
++Num_failures; \
cerr << "\nF - " << __FUNCTION__ << "(" << __FILE__ << ":" << __LINE__ << "): " << #X << '\n'; \
Passed = false; \
return; /* Currently we stop at the very first failure. */ \
@ -32,7 +31,6 @@ long Num_failures = 0;
#define CHECK_EQ(X, Y) \
if (Passed && (X) != (Y)) { \
++Num_failures; \
cerr << "\nF - " << __FUNCTION__ << "(" << __FILE__ << ":" << __LINE__ << "): " << #X << " == " << #Y << '\n'; \
cerr << " got " << (X) << '\n'; /* BEWARE: multiple eval */ \
Passed = false; \
@ -82,6 +80,7 @@ void run_test(size_t i) {
// End Test Teardown
teardown();
if (Passed) cerr << '.';
else ++Num_failures;
}
bool is_integer(const string& s) {

View File

@ -178,7 +178,6 @@ int Trace_errors = 0; // used only when Trace_stream is NULL
:(before "End Test Teardown")
if (Passed && !Hide_errors && trace_count("error") > 0) {
Passed = false;
++Num_failures;
}
:(before "End Types")
@ -220,7 +219,6 @@ START_TRACING_UNTIL_END_OF_SCOPE
#define CHECK_TRACE_CONTAINS_ERROR() CHECK(trace_count("error") > 0)
#define CHECK_TRACE_DOESNT_CONTAIN_ERROR() \
if (Passed && trace_count("error") > 0) { \
++Num_failures; \
cerr << "\nF - " << __FUNCTION__ << "(" << __FILE__ << ":" << __LINE__ << "): unexpected errors\n"; \
DUMP("error"); \
Passed = false; \
@ -229,7 +227,6 @@ START_TRACING_UNTIL_END_OF_SCOPE
#define CHECK_TRACE_COUNT(label, count) \
if (Passed && trace_count(label) != (count)) { \
++Num_failures; \
cerr << "\nF - " << __FUNCTION__ << "(" << __FILE__ << ":" << __LINE__ << "): trace_count of " << label << " should be " << count << '\n'; \
cerr << " got " << trace_count(label) << '\n'; /* multiple eval */ \
DUMP(label); \
@ -260,7 +257,6 @@ bool check_trace_contents(string FUNCTION, string FILE, int LINE, string expecte
split_label_contents(expected_lines.at(curr_expected_line), &label, &contents);
}
++Num_failures;
if (line_exists_anywhere(label, contents)) {
cerr << "\nF - " << FUNCTION << "(" << FILE << ":" << LINE << "): line [" << label << ": " << contents << "] out of order in trace:\n";
DUMP("");

View File

@ -181,8 +181,6 @@ void run_mu_scenario(const scenario& s) {
// End Mu Test Teardown
if (!Hide_errors && trace_count("error") > 0 && !Scenario_testing_scenario)
Passed = false;
if (!Passed)
++Num_failures;
if (not_already_inside_test && Trace_stream) {
teardown();
if (Save_trace) {