//: A simple test harness. To create new tests define functions starting with //: 'test_'. To run all tests so defined, run: //: $ mu test //: //: So far it seems tasteful for layers to never ever reach back to modify //: previously-defined tests. Every test is a contract once written, and should //: pass as-is if it is included, regardless of how much later layers change //: the program. Avoid writing 'temporary' tests that only work with some //: subsets of the program. :(before "End Types") typedef void (*test_fn)(void); :(before "End Globals") 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; #define CHECK(X) \ if (!(X)) { \ ++Num_failures; \ cerr << "\nthreads:on -d:threadsafe