about summary refs log tree commit diff stats
path: root/subx/002test.cc
diff options
context:
space:
mode:
authorKartik K. Agaram <vc@akkartik.com>2017-10-09 01:19:33 -0700
committerKartik K. Agaram <vc@akkartik.com>2017-10-09 01:19:33 -0700
commit224474d7fd04263b7300d22df337c33b97de5fe5 (patch)
treee77ac61a2fa74cae48a5fde69e18efb5e4c51e6a /subx/002test.cc
parent36f616b5c011e32e4a8be1a4864f81e11424de89 (diff)
downloadmu-224474d7fd04263b7300d22df337c33b97de5fe5.tar.gz
4011 - start of sub-x86 VM
Diffstat (limited to 'subx/002test.cc')
-rw-r--r--subx/002test.cc17
1 files changed, 8 insertions, 9 deletions
diff --git a/subx/002test.cc b/subx/002test.cc
index 1d8efb08..f6623c90 100644
--- a/subx/002test.cc
+++ b/subx/002test.cc
@@ -19,7 +19,6 @@ const test_fn Tests[] = {
 :(before "End Globals")
 bool Run_tests = false;
 bool Passed = true;  // set this to false inside any test to indicate failure
-long Num_failures = 0;
 
 :(before "End Includes")
 #define CHECK(X) \
@@ -37,7 +36,7 @@ long Num_failures = 0;
     return;  /* Currently we stop at the very first failure. */ \
   }
 
-:(before "End Setup")
+:(before "End Reset")
 Passed = true;
 
 :(before "End Commandline Parsing")
@@ -50,18 +49,21 @@ if (Run_tests) {
   // Test Runs
   // we run some tests and then exit; assume no state need be maintained afterward
 
+  long num_failures = 0;
   // End Test Run Initialization
   time_t t;  time(&t);
   cerr << "C tests: " << ctime(&t);
   for (size_t i=0;  i < sizeof(Tests)/sizeof(Tests[0]);  ++i) {
 //?     cerr << "running .build/test_list line " << (i+1) << '\n';
     run_test(i);
+    if (Passed) cerr << '.';
+    else ++num_failures;
   }
   cerr << '\n';
   // End Tests
-  if (Num_failures > 0) {
-    cerr << Num_failures << " failure"
-         << (Num_failures > 1 ? "s" : "")
+  if (num_failures > 0) {
+    cerr << num_failures << " failure"
+         << (num_failures > 1 ? "s" : "")
          << '\n';
     return 1;
   }
@@ -74,13 +76,10 @@ void run_test(size_t i) {
     cerr << "no test " << i << '\n';
     return;
   }
-  setup();
+  reset();
   // End Test Setup
   (*Tests[i])();
   // End Test Teardown
-  teardown();
-  if (Passed) cerr << '.';
-  else ++Num_failures;
 }
 
 bool is_integer(const string& s) {