diff options
author | Chris Wilson <chris+github@qwirx.com> | 2014-12-21 15:38:14 +0000 |
---|---|---|
committer | Chris Wilson <chris+github@qwirx.com> | 2014-12-21 15:38:14 +0000 |
commit | 1fc2355abbaa68adb4f62a9a146beee224d78804 (patch) | |
tree | 309d5f6bfb5e1eeeca21e6f4b9f34b04acf9491b /lib | |
parent | 92b6831cb64513fdea84481c328fb59a394ca40d (diff) |
Add a TEST_LINE_OR macro to compare strings and execute a command if no equal.
Diffstat (limited to 'lib')
-rw-r--r-- | lib/common/Test.h | 9 |
1 files changed, 8 insertions, 1 deletions
diff --git a/lib/common/Test.h b/lib/common/Test.h index 146fafae..be481ddd 100644 --- a/lib/common/Test.h +++ b/lib/common/Test.h @@ -146,7 +146,7 @@ extern std::list<std::string> run_only_named_tests; } \ } -// utility macro for testing a line +// utility macros for testing a string/output line #define TEST_LINE(_condition, _line) \ TEST_THAT(_condition); \ if (!(_condition)) \ @@ -157,6 +157,13 @@ extern std::list<std::string> run_only_named_tests; printf("Test failed on <%s>\n", _line_str.c_str()); \ } +#define TEST_LINE_OR(_condition, _line, _or_command) \ + TEST_LINE(_condition, _line); \ + if(!(_condition)) \ + { \ + _or_command; \ + } + #define TEST_STARTSWITH(expected, actual) \ TEST_EQUAL_LINE(expected, actual.substr(0, std::string(expected).size()), actual); |