diff options
author | Kartik K. Agaram <vc@akkartik.com> | 2015-02-16 15:27:02 -0800 |
---|---|---|
committer | Kartik K. Agaram <vc@akkartik.com> | 2015-02-16 15:27:49 -0800 |
commit | 88663269262e882f63df23ea0ce93f3e95d74a2c (patch) | |
tree | ba16f4022e8c50d597972d3596932feed0232046 /cpp/000test.cc | |
parent | f42a8ddc38ec6438c70f7ad5a2b3db3e29280f8e (diff) | |
download | mu-88663269262e882f63df23ea0ce93f3e95d74a2c.tar.gz |
763 - start of C++ version
Diffstat (limited to 'cpp/000test.cc')
-rw-r--r-- | cpp/000test.cc | 26 |
1 files changed, 26 insertions, 0 deletions
diff --git a/cpp/000test.cc b/cpp/000test.cc new file mode 100644 index 00000000..2754b254 --- /dev/null +++ b/cpp/000test.cc @@ -0,0 +1,26 @@ +typedef void (*test_fn)(void); + +const test_fn Tests[] = { + #include "test_list" // auto-generated; see makefile +}; + +bool Passed = true; + +long Num_failures = 0; + +#define CHECK(X) \ + if (!(X)) { \ + ++Num_failures; \ + cerr << "\nF " << __FUNCTION__ << "(" << __FILE__ << ":" << __LINE__ << "): " << #X << '\n'; \ + Passed = false; \ + return; \ + } + +#define CHECK_EQ(X, Y) \ + if ((X) != (Y)) { \ + ++Num_failures; \ + cerr << "\nF " << __FUNCTION__ << "(" << __FILE__ << ":" << __LINE__ << "): " << #X << " == " << #Y << '\n'; \ + cerr << " got " << (X) << '\n'; /* BEWARE: multiple eval */ \ + Passed = false; \ + return; \ + } |