From 9542bb112419d575190a72baf7f964c3e32df223 Mon Sep 17 00:00:00 2001 From: "Kartik K. Agaram" Date: Sat, 25 Jul 2015 22:15:51 -0700 Subject: 1853 --- html/002test.cc.html | 43 ++++++++++++++++++++++--------------------- 1 file changed, 22 insertions(+), 21 deletions(-) (limited to 'html/002test.cc.html') diff --git a/html/002test.cc.html b/html/002test.cc.html index 4c280e92..6d7eb925 100644 --- a/html/002test.cc.html +++ b/html/002test.cc.html @@ -15,10 +15,11 @@ body { font-family: monospace; color: #eeeeee; background-color: #080808; } * { font-size: 1.05em; } .cSpecial { color: #008000; } .Constant { color: #00a0a0; } +.Normal { color: #eeeeee; background-color: #080808; padding-bottom: 1px; } .Comment { color: #9090ff; } .Delimiter { color: #a04060; } -.PreProc { color: #c000c0; } .CommentedCode { color: #6c6c6c; } +.PreProc { color: #c000c0; } .Identifier { color: #804000; } --> @@ -42,19 +43,19 @@ body { font-family: monospace; color: #eeeeee; background-color: #080808; } //: subsets of the program. :(before "End Types") -typedef void (*test_fn)(void); +typedef void (*test_fn)(void); :(before "End Globals") -const test_fn Tests[] = { +const test_fn Tests[] = { #include "test_list" // auto-generated; see makefile }; -bool Run_tests = false; -bool Passed = true; // set this to false inside any test to indicate failure -long Num_failures = 0; +bool Run_tests = false; +bool Passed = true; // set this to false inside any test to indicate failure +long Num_failures = 0; #define CHECK(X) \ - if (!(X)) { \ + if (!(X)) { \ ++Num_failures; \ cerr << "\nF - " << __FUNCTION__ << "(" << __FILE__ << ":" << __LINE__ << "): " << #X << '\n'; \ Passed = false; \ @@ -62,7 +63,7 @@ long Num_failures = 0; } #define CHECK_EQ(X, Y) \ - if ((X) != (Y)) { \ + if ((X) != (Y)) { \ ++Num_failures; \ cerr << "\nF - " << __FUNCTION__ << "(" << __FILE__ << ":" << __LINE__ << "): " << #X << " == " << #Y << '\n'; \ cerr << " got " << (X) << '\n'; /* BEWARE: multiple eval */ \ @@ -74,25 +75,25 @@ long Num_failures = 0;true; :(before "End Commandline Parsing") -if (argc > 1 && is_equal(argv[1], "test")) { +if (argc > 1 && is_equal(argv[1], "test")) { Run_tests = true; --argc; ++argv; // shift 'test' out of commandline args } :(before "End Main") -if (Run_tests) { +if (Run_tests) { // Test Runs // we run some tests and then exit; assume no state need be maintained afterward // End Test Run Initialization - time_t t; time(&t); + time_t t; time(&t); cerr << "C tests: " << ctime(&t); - for (size_t i=0; i < sizeof(Tests)/sizeof(Tests[0]); ++i) { + for (size_t i=0; i < sizeof(Tests)/sizeof(Tests[0]); ++i) { //? cerr << i << '\n'; //? 2 run_test(i); } // End Tests cerr << '\n'; - if (Num_failures > 0) { + if (Num_failures > 0) { cerr << Num_failures << " failure" << (Num_failures > 1 ? "s" : "") << '\n'; @@ -102,8 +103,8 @@ if (Run_tests) } :(code) -void run_test(size_t i) { - if (i >= sizeof(Tests)/sizeof(Tests[0])) { +void run_test(size_t i) { + if (i >= sizeof(Tests)/sizeof(Tests[0])) { cerr << "no test " << i << '\n'; return; } @@ -111,18 +112,18 @@ void run_test(size_t i)// End Test Setup (*Tests[i])(); teardown(); - if (Passed) cerr << "."; + if (Passed) cerr << "."; } -bool is_integer(const string& s) { +bool is_integer(const string& s) { return s.find_first_not_of("0123456789-") == string::npos; } -long long int to_integer(string n) { - char* end = NULL; +long long int to_integer(string n) { + char* end = NULL; // safe because string.c_str() is guaranteed to be null-terminated - long long int result = strtoll(n.c_str(), &end, /*any base*/0); - if (*end != '\0') cerr << "tried to convert " << n << " to number\n"; + long long int result = strtoll(n.c_str(), &end, /*any base*/0); + if (*end != '\0') cerr << "tried to convert " << n << " to number\n"; assert(*end == '\0'); return result; } -- cgit 1.4.1-2-gfad0