diff options
author | Kartik K. Agaram <vc@akkartik.com> | 2016-08-28 23:27:04 -0700 |
---|---|---|
committer | Kartik K. Agaram <vc@akkartik.com> | 2016-08-28 23:27:04 -0700 |
commit | 4e39c6bb082d6f7c0aaab9767b9b279490bce290 (patch) | |
tree | 80019e6f6b724b26d80455cb74ecc149ac8f3c16 | |
parent | 5f05e954ee1f1daf953b3ff20af81775f226d5bf (diff) | |
download | mu-4e39c6bb082d6f7c0aaab9767b9b279490bce290.tar.gz |
3274
Always keep macro definitions in the Includes section.
-rw-r--r-- | 003trace.cc | 44 |
1 files changed, 22 insertions, 22 deletions
diff --git a/003trace.cc b/003trace.cc index 05a2fa15..3f08aa40 100644 --- a/003trace.cc +++ b/003trace.cc @@ -214,6 +214,28 @@ START_TRACING_UNTIL_END_OF_SCOPE :(before "End Includes") #define CHECK_TRACE_CONTENTS(...) check_trace_contents(__FUNCTION__, __FILE__, __LINE__, __VA_ARGS__) +#define CHECK_TRACE_CONTAINS_ERROR() CHECK(trace_count("error") > 0) +#define CHECK_TRACE_DOESNT_CONTAIN_ERROR() \ + if (trace_count("error") > 0) { \ + ++Num_failures; \ + cerr << "\nF - " << __FUNCTION__ << "(" << __FILE__ << ":" << __LINE__ << "): unexpected errors\n"; \ + DUMP("error"); \ + Passed = false; \ + return; \ + } + +#define CHECK_TRACE_COUNT(label, count) \ + if (trace_count(label) != (count)) { \ + ++Num_failures; \ + cerr << "\nF - " << __FUNCTION__ << "(" << __FILE__ << ":" << __LINE__ << "): trace_count of " << label << " should be " << count << '\n'; \ + cerr << " got " << trace_count(label) << '\n'; /* multiple eval */ \ + DUMP(label); \ + Passed = false; \ + return; /* Currently we stop at the very first failure. */ \ + } + +#define CHECK_TRACE_DOESNT_CONTAIN(...) CHECK(trace_doesnt_contain(__VA_ARGS__)) + :(code) bool check_trace_contents(string FUNCTION, string FILE, int LINE, string expected) { if (!Trace_stream) return false; @@ -296,26 +318,6 @@ int trace_count_prefix(string label, string prefix) { return result; } -#define CHECK_TRACE_CONTAINS_ERROR() CHECK(trace_count("error") > 0) -#define CHECK_TRACE_DOESNT_CONTAIN_ERROR() \ - if (trace_count("error") > 0) { \ - ++Num_failures; \ - cerr << "\nF - " << __FUNCTION__ << "(" << __FILE__ << ":" << __LINE__ << "): unexpected errors\n"; \ - DUMP("error"); \ - Passed = false; \ - return; \ - } - -#define CHECK_TRACE_COUNT(label, count) \ - if (trace_count(label) != (count)) { \ - ++Num_failures; \ - cerr << "\nF - " << __FUNCTION__ << "(" << __FILE__ << ":" << __LINE__ << "): trace_count of " << label << " should be " << count << '\n'; \ - cerr << " got " << trace_count(label) << '\n'; /* multiple eval */ \ - DUMP(label); \ - Passed = false; \ - return; /* Currently we stop at the very first failure. */ \ - } - bool trace_doesnt_contain(string label, string line) { return trace_count(label, line) == 0; } @@ -325,8 +327,6 @@ bool trace_doesnt_contain(string expected) { return trace_doesnt_contain(tmp.at(0), tmp.at(1)); } -#define CHECK_TRACE_DOESNT_CONTAIN(...) CHECK(trace_doesnt_contain(__VA_ARGS__)) - vector<string> split(string s, string delim) { vector<string> result; size_t begin=0, end=s.find(delim); |