diff options
author | Kartik K. Agaram <vc@akkartik.com> | 2015-05-12 13:10:23 -0700 |
---|---|---|
committer | Kartik K. Agaram <vc@akkartik.com> | 2015-05-12 17:00:19 -0700 |
commit | 3663ca6c2d4c42c4a7bf6af4b2edf71dd8d10dd7 (patch) | |
tree | 330d04974b9d30bff1b16adc8d14a3d9fd77643d /050scenario.cc | |
parent | a70d593dfb8eea87a898a69adeb9689a21199edf (diff) | |
download | mu-3663ca6c2d4c42c4a7bf6af4b2edf71dd8d10dd7.tar.gz |
1356 - snapshot #2: floating point support
I added one test to check that divide can return a float, then hacked at the rippling failures across the entire entire codebase until all tests pass. Now I need to look at the changes I made and see if there's a system to them, identify other places that I missed, and figure out the best way to cover all cases. I also need to show real rather than encoded values in the traces, but I can't use value() inside reagent methods because of the name clash with the member variable. So let's take a snapshot before we attempt any refactoring. This was non-trivial to get right. Even if I convince myself that I've gotten it right, I might back this all out if I can't easily *persuade others* that I've gotten it right.
Diffstat (limited to '050scenario.cc')
-rw-r--r-- | 050scenario.cc | 20 |
1 files changed, 10 insertions, 10 deletions
diff --git a/050scenario.cc b/050scenario.cc index c5ff2765..3aa34089 100644 --- a/050scenario.cc +++ b/050scenario.cc @@ -88,7 +88,7 @@ time_t mu_time; time(&mu_time); cerr << "\nMu tests: " << ctime(&mu_time); for (index_t i = 0; i < Scenarios.size(); ++i) { //? cerr << Passed << '\n'; //? 1 -//? cerr << i << ": " << Scenarios.at(i).name << '\n'; //? 2 +//? cerr << i << ": " << Scenarios.at(i).name << '\n'; //? 3 run_mu_scenario(Scenarios.at(i)); if (Passed) cerr << "."; } @@ -215,15 +215,15 @@ void check_memory(const string& s) { skip_whitespace_and_comments(in); string _assign; in >> _assign; assert(_assign == "<-"); skip_whitespace_and_comments(in); - int value = 0; in >> value; + int expected_value = 0; in >> expected_value; if (locations_checked.find(address) != locations_checked.end()) raise << "duplicate expectation for location " << address << '\n'; trace("run") << "checking location " << address; - if (Memory[address] != value) { + if (value(Memory[address]) != expected_value) { if (Current_scenario) - raise << "\nF - " << Current_scenario->name << ": expected location " << address << " to contain " << value << " but saw " << Memory[address] << '\n'; + raise << "\nF - " << Current_scenario->name << ": expected location " << address << " to contain " << expected_value << " but saw " << value(Memory[address]) << '\n'; else - raise << "expected location " << address << " to contain " << value << " but saw " << Memory[address] << '\n'; + raise << "expected location " << address << " to contain " << expected_value << " but saw " << value(Memory[address]) << '\n'; Passed = false; return; } @@ -234,7 +234,7 @@ void check_memory(const string& s) { void check_type(const string& lhs, istream& in) { reagent x(lhs); if (x.properties.at(0).second.at(0) == "string") { - x.set_value(to_number(x.name)); + x.set_value(mu_integer(to_number(x.name))); // address must be a positive integer skip_whitespace_and_comments(in); string _assign = next_word(in); assert(_assign == "<-"); @@ -252,13 +252,13 @@ void check_type(const string& lhs, istream& in) { void check_string(index_t address, const string& literal) { trace("run") << "checking string length at " << address; - if (Memory[address] != static_cast<signed>(literal.size())) - raise << "expected location " << address << " to contain length " << literal.size() << " of string [" << literal << "] but saw " << Memory[address] << '\n'; + if (value(Memory[address]) != static_cast<signed>(literal.size())) + raise << "expected location " << address << " to contain length " << literal.size() << " of string [" << literal << "] but saw " << value(Memory[address]) << '\n'; ++address; // now skip length for (index_t i = 0; i < literal.size(); ++i) { trace("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 (value(Memory[address+i]) != literal.at(i)) + raise << "expected location " << (address+i) << " to contain " << literal.at(i) << " but saw " << value(Memory[address+i]) << '\n'; } } |