about summary refs log tree commit diff stats
path: root/050scenario.cc
diff options
context:
space:
mode:
authorKartik K. Agaram <vc@akkartik.com>2015-05-23 12:30:58 -0700
committerKartik K. Agaram <vc@akkartik.com>2015-05-23 12:35:05 -0700
commit047296d811b062477715e3435e1b49ae63d54501 (patch)
treee271c65abd0adafd43f75ad766834e238c7eb89b /050scenario.cc
parenta95c44f6981946d87e05d0929c0dd3a4894e953e (diff)
downloadmu-047296d811b062477715e3435e1b49ae63d54501.tar.gz
1434 - support all unicode spaces
Diffstat (limited to '050scenario.cc')
-rw-r--r--050scenario.cc26
1 files changed, 22 insertions, 4 deletions
diff --git a/050scenario.cc b/050scenario.cc
index 1d7366cd..8df08e77 100644
--- a/050scenario.cc
+++ b/050scenario.cc
@@ -252,13 +252,31 @@ void check_type(const string& lhs, istream& in) {
 
 void check_string(long long int address, const string& literal) {
   trace(Primitive_recipe_depth, "run") << "checking string length at " << address;
-  if (Memory[address] != SIZE(literal))
-    raise << "expected location " << address << " to contain length " << SIZE(literal) << " of string [" << literal << "] but saw " << Memory[address] << '\n';
+  if (Memory[address] != SIZE(literal)) {
+    if (Current_scenario && !Hide_warnings)
+      raise << "\nF - " << Current_scenario->name << ": expected location " << address << " to contain length " << SIZE(literal) << " of string [" << literal << "] but saw " << Memory[address] << '\n';
+    else
+      raise << "expected location " << address << " to contain length " << SIZE(literal) << " of string [" << literal << "] but saw " << Memory[address] << '\n';
+    if (!Hide_warnings) {
+      Passed = false;
+      ++Num_failures;
+    }
+    return;
+  }
   ++address;  // now skip length
   for (long long int i = 0; i < SIZE(literal); ++i) {
     trace(Primitive_recipe_depth, "run") << "checking location " << address+i;
-    if (Memory[address+i] != literal.at(i))
-      raise << "expected location " << (address+i) << " to contain " << literal.at(i) << " but saw " << Memory[address+i] << '\n';
+    if (Memory[address+i] != literal.at(i)) {
+      if (Current_scenario && !Hide_warnings)
+        raise << "\nF - " << Current_scenario->name << ": expected location " << (address+i) << " to contain " << literal.at(i) << " but saw " << Memory[address+i] << '\n';
+      else
+        raise << "expected location " << (address+i) << " to contain " << literal.at(i) << " but saw " << Memory[address+i] << '\n';
+      if (!Hide_warnings) {
+        Passed = false;
+        ++Num_failures;
+      }
+      return;
+    }
   }
 }