about summary refs log tree commit diff stats
path: root/072scenario_screen.cc
diff options
context:
space:
mode:
authorKartik K. Agaram <vc@akkartik.com>2015-09-14 23:30:03 -0700
committerKartik K. Agaram <vc@akkartik.com>2015-09-14 23:37:12 -0700
commit4082acd24f0049604f840fb5e60977e247aafbdf (patch)
treeee0e15149954af80c20f010c47b2f412961ee199 /072scenario_screen.cc
parente28fa5f1508ef7ffeb0b72406558534928c28f9e (diff)
downloadmu-4082acd24f0049604f840fb5e60977e247aafbdf.tar.gz
2199 - stop printing numbers in scientific notation
Turns out the default format for printing floating point numbers is
neither 'scientific' nor 'fixed' even though those are the only two
options offered. Reading the C++ standard I found out that the default
(modulo locale changes) is basically the same as the printf "%g" format.
And "%g" is basically the shorter of:
  a) %f with trailing zeros trimmed
  b) %e
So we'll just do %f and trim trailing zeros.
Diffstat (limited to '072scenario_screen.cc')
-rw-r--r--072scenario_screen.cc10
1 files changed, 5 insertions, 5 deletions
diff --git a/072scenario_screen.cc b/072scenario_screen.cc
index 2b885d58..29ae4c5d 100644
--- a/072scenario_screen.cc
+++ b/072scenario_screen.cc
@@ -219,11 +219,11 @@ void check_screen(const string& expected_contents, const int color) {
         // contents match but color is off
         if (Current_scenario && !Scenario_testing_scenario) {
           // genuine test in a mu file
-          raise << "\nF - " << Current_scenario->name << ": expected screen location (" << row << ", " << column << ", address " << addr << ", value " << Memory[addr] << ") to be in color " << color << " instead of " << Memory[addr+cell_color_offset] << "\n" << end();
+          raise << "\nF - " << Current_scenario->name << ": expected screen location (" << row << ", " << column << ", address " << addr << ", value " << no_scientific(Memory[addr]) << ") to be in color " << color << " instead of " << no_scientific(Memory[addr+cell_color_offset]) << "\n" << end();
         }
         else {
           // just testing check_screen
-          raise << "expected screen location (" << row << ", " << column << ") to be in color " << color << " instead of " << Memory[addr+cell_color_offset] << '\n' << end();
+          raise << "expected screen location (" << row << ", " << column << ") to be in color " << color << " instead of " << no_scientific(Memory[addr+cell_color_offset]) << '\n' << end();
         }
         if (!Scenario_testing_scenario) {
           Passed = false;
@@ -247,12 +247,12 @@ void check_screen(const string& expected_contents, const int color) {
 
       if (Current_scenario && !Scenario_testing_scenario) {
         // genuine test in a mu file
-        raise << "\nF - " << Current_scenario->name << ": expected screen location (" << row << ", " << column << ") to contain " << curr << expected_pretty << " instead of " << Memory[addr] << actual_pretty << '\n' << end();
+        raise << "\nF - " << Current_scenario->name << ": expected screen location (" << row << ", " << column << ") to contain " << curr << expected_pretty << " instead of " << no_scientific(Memory[addr]) << actual_pretty << '\n' << end();
         dump_screen();
       }
       else {
         // just testing check_screen
-        raise << "expected screen location (" << row << ", " << column << ") to contain " << curr << expected_pretty << " instead of " << Memory[addr] << actual_pretty << '\n' << end();
+        raise << "expected screen location (" << row << ", " << column << ") to contain " << curr << expected_pretty << " instead of " << no_scientific(Memory[addr]) << actual_pretty << '\n' << end();
       }
       if (!Scenario_testing_scenario) {
         Passed = false;
@@ -334,7 +334,7 @@ void dump_screen() {
     cerr << '.';
     for (long long int col = 0; col < screen_width; ++col) {
       if (Memory[curr])
-        cerr << to_unicode(Memory[curr]);
+        cerr << to_unicode(static_cast<uint32_t>(Memory[curr]));
       else
         cerr << ' ';
       curr += /*size of screen-cell*/2;