about summary refs log tree commit diff stats
diff options
context:
space:
mode:
-rw-r--r--003trace.cc26
1 files changed, 18 insertions, 8 deletions
diff --git a/003trace.cc b/003trace.cc
index 4ac9efa6..2481c0be 100644
--- a/003trace.cc
+++ b/003trace.cc
@@ -218,12 +218,8 @@ bool check_trace_contents(string FUNCTION, string FILE, int LINE, string expecte
   string label, contents;
   split_label_contents(expected_lines.at(curr_expected_line), &label, &contents);
   for (vector<trace_line>::iterator p = Trace_stream->past_lines.begin(); p != Trace_stream->past_lines.end(); ++p) {
-    if (label != p->label)
-      continue;
-
-    if (contents != trim(p->contents))
-      continue;
-
+    if (label != p->label) continue;
+    if (contents != trim(p->contents)) continue;
     ++curr_expected_line;
     while (curr_expected_line < SIZE(expected_lines) && expected_lines.at(curr_expected_line).empty())
       ++curr_expected_line;
@@ -232,8 +228,14 @@ bool check_trace_contents(string FUNCTION, string FILE, int LINE, string expecte
   }
 
   ++Num_failures;
-  cerr << "\nF - " << FUNCTION << "(" << FILE << ":" << LINE << "): missing [" << contents << "] in trace:\n";
-  DUMP(label);
+  if (line_exists_anywhere(label, contents)) {
+    cerr << "\nF - " << FUNCTION << "(" << FILE << ":" << LINE << "): line [" << label << ": " << contents << "] out of order in trace:\n";
+    DUMP("");
+  }
+  else {
+    cerr << "\nF - " << FUNCTION << "(" << FILE << ":" << LINE << "): missing [" << contents << "] in trace:\n";
+    DUMP(label);
+  }
   Passed = false;
   return false;
 }
@@ -251,6 +253,14 @@ void split_label_contents(const string& s, string* label, string* contents) {
   }
 }
 
+bool line_exists_anywhere(const string& label, const string& contents) {
+  for (vector<trace_line>::iterator p = Trace_stream->past_lines.begin(); p != Trace_stream->past_lines.end(); ++p) {
+    if (label != p->label) continue;
+    if (contents == trim(p->contents)) return true;
+  }
+  return false;
+}
+
 
 
 int trace_count(string label) {