From db1f56c8449d2ea3d158753fe37bac5a750a2566 Mon Sep 17 00:00:00 2001 From: "Kartik K. Agaram" Date: Sun, 29 Nov 2015 14:18:52 -0800 Subject: 2611 --- html/050scenario.cc.html | 28 ++++++++++++++++------------ 1 file changed, 16 insertions(+), 12 deletions(-) (limited to 'html/050scenario.cc.html') diff --git a/html/050scenario.cc.html b/html/050scenario.cc.html index c586b575..523ea59f 100644 --- a/html/050scenario.cc.html +++ b/html/050scenario.cc.html @@ -233,9 +233,13 @@ case RUN: { case RUN: { ostringstream tmp; tmp << "recipe run" << Next_recipe_ordinal << " [ " << current_instruction().ingredients.at(0).name << " ]"; +//? cerr << "before load\n"; vector<recipe_ordinal> tmp_recipe = load(tmp.str()); +//? cerr << "before bind\n"; bind_special_scenario_names(tmp_recipe.at(0)); +//? cerr << "before transform\n"; transform_all(); +//? cerr << "end\n"; if (Trace_stream) { ++Trace_stream->callstack_depth; trace(9998, "trace") << "run: incrementing callstack depth to " << Trace_stream->callstack_depth << end(); @@ -306,7 +310,7 @@ void check_memory(const string& s; while (true) { skip_whitespace_and_comments(in); - if (in.eof()) break; + if (!has_data(in)) break; string lhs = next_word(in); if (!is_integer(lhs)) { check_type(lhs, in); @@ -341,7 +345,10 @@ void check_memory(const string& s(const string& lhs, istream& in) { reagent x(lhs); - if (x.properties.at(0).second->value == "string") { + const string_tree* type_name = x.properties.at(0).second; + if (type_name->value == "array" + && type_name->right && type_name->right->value == "character" + && !type_name->right->right) { x.set_value(to_integer(x.name)); skip_whitespace_and_comments(in); string _assign = next_word(in); @@ -362,7 +369,7 @@ void check_string(long long int address(9999, "run") << "checking string length at " << address << end(); if (get_or_insert(Memory, address) != SIZE(literal)) { if (Current_scenario && !Scenario_testing_scenario) - raise_error << "\nF - " << Current_scenario->name << ": expected location " << address << " to contain length " << SIZE(literal) << " of string [" << literal << "] but saw " << no_scientific(get_or_insert(Memory, address)) << '\n' << end(); + raise_error << "\nF - " << Current_scenario->name << ": expected location " << address << " to contain length " << SIZE(literal) << " of string [" << literal << "] but saw " << no_scientific(get_or_insert(Memory, address)) << " (" << read_mu_string(address) << ")\n" << end(); else raise_error << "expected location " << address << " to contain length " << SIZE(literal) << " of string [" << literal << "] but saw " << no_scientific(get_or_insert(Memory, address)) << '\n' << end(); if (!Scenario_testing_scenario) { @@ -377,7 +384,7 @@ void check_string(long long int address(get_or_insert(Memory, address+i) != literal.at(i)) { if (Current_scenario && !Scenario_testing_scenario) { // genuine test in a mu file - raise_error << "\nF - " << Current_scenario->name << ": expected location " << (address+i) << " to contain " << literal.at(i) << " but saw " << no_scientific(get_or_insert(Memory, address+i)) << '\n' << end(); + raise_error << "\nF - " << Current_scenario->name << ": expected location " << (address+i) << " to contain " << literal.at(i) << " but saw " << no_scientific(get_or_insert(Memory, address+i)) << " ('" << static_cast<char>(get_or_insert(Memory, address+i)) << "')\n" << end(); } else { // just testing scenario support @@ -412,7 +419,7 @@ recipe main [ 3:number <- copy 98 # 'b' 4:number <- copy 99 # 'c' memory-should-contain [ - 1:string <- [ab] + 1:array:character <- [ab] ] ] +error: expected location 1 to contain length 2 of string [ab] but saw 3 @@ -424,7 +431,7 @@ recipe main [ 3:number <- copy 98 # 'b' 4:number <- copy 99 # 'c' memory-should-contain [ - 1:string <- [abc] + 1:array:character <- [abc] ] ] +run: checking string length at 1 @@ -467,25 +474,22 @@ case TRACE_SHOULD_CONTAIN: { :(code) // simplified version of check_trace_contents() that emits errors rather // than just printing to stderr -bool check_trace(const string& expected) { +void check_trace(const string& expected) { Trace_stream->newline(); vector<trace_line> expected_lines = parse_trace(expected); - if (expected_lines.empty()) return true; + if (expected_lines.empty()) return; long long int curr_expected_line = 0; for (vector<trace_line>::iterator p = Trace_stream->past_lines.begin(); p != Trace_stream->past_lines.end(); ++p) { if (expected_lines.at(curr_expected_line).label != p->label) continue; if (expected_lines.at(curr_expected_line).contents != trim(p->contents)) continue; // match ++curr_expected_line; - if (curr_expected_line == SIZE(expected_lines)) { - return true; - } + if (curr_expected_line == SIZE(expected_lines)) return; } raise_error << "missing [" << expected_lines.at(curr_expected_line).contents << "] " << "in trace with label " << expected_lines.at(curr_expected_line).label << '\n' << end(); Passed = false; - return false; } vector<trace_line> parse_trace(const string& expected) { -- cgit 1.4.1-2-gfad0