From 4a48bedcd1d708a43d43dc6259a4e45c52ea3d00 Mon Sep 17 00:00:00 2001 From: "Kartik K. Agaram" Date: Sun, 3 Dec 2017 23:25:40 -0800 Subject: 4134 - 'input' = 'ingredient' --- html/082scenario_screen.cc.html | 44 ++++++++++++++++++++--------------------- 1 file changed, 22 insertions(+), 22 deletions(-) (limited to 'html/082scenario_screen.cc.html') diff --git a/html/082scenario_screen.cc.html b/html/082scenario_screen.cc.html index cde419df..37b9d73c 100644 --- a/html/082scenario_screen.cc.html +++ b/html/082scenario_screen.cc.html @@ -315,19 +315,19 @@ if ('onhashchange' in window) { 250 251 :(code) 252 void check_screen(const string& expected_contents, const int color) { -253 int screen_location = get_or_insert(Memory, SCREEN)+/*skip refcount*/1; +253 int screen_location = get_or_insert(Memory, SCREEN)+/*skip refcount*/1; 254 int data_offset = find_element_name(get(Type_ordinal, "screen"), "data", ""); 255 assert(data_offset >= 0); 256 int screen_data_location = screen_location+data_offset; // type: address:array:character -257 int screen_data_start = get_or_insert(Memory, screen_data_location) + /*skip refcount*/1; // type: array:character +257 int screen_data_start = get_or_insert(Memory, screen_data_location) + /*skip refcount*/1; // type: array:character 258 int width_offset = find_element_name(get(Type_ordinal, "screen"), "num-columns", ""); -259 int screen_width = get_or_insert(Memory, screen_location+width_offset); +259 int screen_width = get_or_insert(Memory, screen_location+width_offset); 260 int height_offset = find_element_name(get(Type_ordinal, "screen"), "num-rows", ""); -261 int screen_height = get_or_insert(Memory, screen_location+height_offset); +261 int screen_height = get_or_insert(Memory, screen_location+height_offset); 262 raw_string_stream cursor(expected_contents); 263 // todo: too-long expected_contents should fail 264 int top_index_offset = find_element_name(get(Type_ordinal, "screen"), "top-idx", ""); -265 int top_index = get_or_insert(Memory, screen_location+top_index_offset); +265 int top_index = get_or_insert(Memory, screen_location+top_index_offset); 266 for (int i=0, row=top_index/screen_width; i < screen_height; ++i, row=(row+1)%screen_height) { 267 ¦ cursor.skip_whitespace_and_comments(); 268 ¦ if (cursor.at_end()) break; @@ -340,16 +340,16 @@ if ('onhashchange' in window) { 275 ¦ for (int column = 0; column < screen_width; ++column, addr+= /*size of screen-cell*/2) { 276 ¦ ¦ const int cell_color_offset = 1; 277 ¦ ¦ uint32_t curr = cursor.get(); -278 ¦ ¦ if (get_or_insert(Memory, addr) == 0 && isspace(curr)) continue; -279 ¦ ¦ if (curr == ' ' && color != -1 && color != get_or_insert(Memory, addr+cell_color_offset)) { +278 ¦ ¦ if (get_or_insert(Memory, addr) == 0 && isspace(curr)) continue; +279 ¦ ¦ if (curr == ' ' && color != -1 && color != get_or_insert(Memory, addr+cell_color_offset)) { 280 ¦ ¦ ¦ // filter out other colors 281 ¦ ¦ ¦ continue; 282 ¦ ¦ } -283 ¦ ¦ if (get_or_insert(Memory, addr) != 0 && get_or_insert(Memory, addr) == curr) { -284 ¦ ¦ ¦ if (color == -1 || color == get_or_insert(Memory, addr+cell_color_offset)) continue; +283 ¦ ¦ if (get_or_insert(Memory, addr) != 0 && get_or_insert(Memory, addr) == curr) { +284 ¦ ¦ ¦ if (color == -1 || color == get_or_insert(Memory, addr+cell_color_offset)) continue; 285 ¦ ¦ ¦ // contents match but color is off 286 ¦ ¦ ¦ if (!Hide_errors) cerr << '\n'; -287 ¦ ¦ ¦ raise << "F - " << maybe(current_recipe_name()) << "expected screen location (" << row << ", " << column << ") to contain '" << unicode_character_at(addr) << "' in color " << color << " instead of " << no_scientific(get_or_insert(Memory, addr+cell_color_offset)) << "\n" << end(); +287 ¦ ¦ ¦ raise << "F - " << maybe(current_recipe_name()) << "expected screen location (" << row << ", " << column << ") to contain '" << unicode_character_at(addr) << "' in color " << color << " instead of " << no_scientific(get_or_insert(Memory, addr+cell_color_offset)) << "\n" << end(); 288 ¦ ¦ ¦ if (!Hide_errors) dump_screen(); 289 ¦ ¦ ¦ if (!Scenario_testing_scenario) Passed = false; 290 ¦ ¦ ¦ return; @@ -363,15 +363,15 @@ if ('onhashchange' in window) { 298 ¦ ¦ ¦ expected_pretty[0] = ' ', expected_pretty[1] = '(', expected_pretty[2] = '\'', expected_pretty[3] = static_cast<unsigned char>(curr), expected_pretty[4] = '\'', expected_pretty[5] = ')', expected_pretty[6] = '\0'; 299 ¦ ¦ } 300 ¦ ¦ char actual_pretty[10] = {0}; -301 ¦ ¦ if (get_or_insert(Memory, addr) < 256 && !iscntrl(get_or_insert(Memory, addr))) { +301 ¦ ¦ if (get_or_insert(Memory, addr) < 256 && !iscntrl(get_or_insert(Memory, addr))) { 302 ¦ ¦ ¦ // " ('<curr>')" -303 ¦ ¦ ¦ actual_pretty[0] = ' ', actual_pretty[1] = '(', actual_pretty[2] = '\'', actual_pretty[3] = static_cast<unsigned char>(get_or_insert(Memory, addr)), actual_pretty[4] = '\'', actual_pretty[5] = ')', actual_pretty[6] = '\0'; +303 ¦ ¦ ¦ actual_pretty[0] = ' ', actual_pretty[1] = '(', actual_pretty[2] = '\'', actual_pretty[3] = static_cast<unsigned char>(get_or_insert(Memory, addr)), actual_pretty[4] = '\'', actual_pretty[5] = ')', actual_pretty[6] = '\0'; 304 ¦ ¦ } 305 306 ¦ ¦ ostringstream color_phrase; 307 ¦ ¦ if (color != -1) color_phrase << " in color " << color; 308 ¦ ¦ if (!Hide_errors) cerr << '\n'; -309 ¦ ¦ raise << "F - " << maybe(current_recipe_name()) << "expected screen location (" << row << ", " << column << ") to contain " << curr << expected_pretty << color_phrase.str() << " instead of " << no_scientific(get_or_insert(Memory, addr)) << actual_pretty << '\n' << end(); +309 ¦ ¦ raise << "F - " << maybe(current_recipe_name()) << "expected screen location (" << row << ", " << column << ") to contain " << curr << expected_pretty << color_phrase.str() << " instead of " << no_scientific(get_or_insert(Memory, addr)) << actual_pretty << '\n' << end(); 310 ¦ ¦ if (!Hide_errors) dump_screen(); 311 ¦ ¦ if (!Scenario_testing_scenario) Passed = false; 312 ¦ ¦ return; @@ -390,7 +390,7 @@ if ('onhashchange' in window) { 325 } 326 327 const char* unicode_character_at(int addr) { -328 int unicode_code_point = static_cast<int>(get_or_insert(Memory, addr)); +328 int unicode_code_point = static_cast<int>(get_or_insert(Memory, addr)); 329 return to_unicode(unicode_code_point); 330 } 331 @@ -450,24 +450,24 @@ if ('onhashchange' in window) { 385 386 :(code) 387 void dump_screen() { -388 int screen_location = get_or_insert(Memory, SCREEN) + /*skip refcount*/1; +388 int screen_location = get_or_insert(Memory, SCREEN) + /*skip refcount*/1; 389 int width_offset = find_element_name(get(Type_ordinal, "screen"), "num-columns", ""); -390 int screen_width = get_or_insert(Memory, screen_location+width_offset); +390 int screen_width = get_or_insert(Memory, screen_location+width_offset); 391 int height_offset = find_element_name(get(Type_ordinal, "screen"), "num-rows", ""); -392 int screen_height = get_or_insert(Memory, screen_location+height_offset); +392 int screen_height = get_or_insert(Memory, screen_location+height_offset); 393 int data_offset = find_element_name(get(Type_ordinal, "screen"), "data", ""); 394 assert(data_offset >= 0); 395 int screen_data_location = screen_location+data_offset; // type: address:array:character -396 int screen_data_start = get_or_insert(Memory, screen_data_location) + /*skip refcount*/1; // type: array:character -397 assert(get_or_insert(Memory, screen_data_start) == screen_width*screen_height); +396 int screen_data_start = get_or_insert(Memory, screen_data_location) + /*skip refcount*/1; // type: array:character +397 assert(get_or_insert(Memory, screen_data_start) == screen_width*screen_height); 398 int top_index_offset = find_element_name(get(Type_ordinal, "screen"), "top-idx", ""); -399 int top_index = get_or_insert(Memory, screen_location+top_index_offset); +399 int top_index = get_or_insert(Memory, screen_location+top_index_offset); 400 for (int i=0, row=top_index/screen_width; i < screen_height; ++i, row=(row+1)%screen_height) { 401 ¦ cerr << '.'; 402 ¦ int curr = screen_data_start+/*length*/1+row*screen_width* /*size of screen-cell*/2; 403 ¦ for (int col = 0; col < screen_width; ++col) { -404 ¦ ¦ if (get_or_insert(Memory, curr)) -405 ¦ ¦ ¦ cerr << to_unicode(static_cast<uint32_t>(get_or_insert(Memory, curr))); +404 ¦ ¦ if (get_or_insert(Memory, curr)) +405 ¦ ¦ ¦ cerr << to_unicode(static_cast<uint32_t>(get_or_insert(Memory, curr))); 406 ¦ ¦ else 407 ¦ ¦ ¦ cerr << ' '; 408 ¦ ¦ curr += /*size of screen-cell*/2; -- cgit 1.4.1-2-gfad0