From 1fc2355abbaa68adb4f62a9a146beee224d78804 Mon Sep 17 00:00:00 2001 From: Chris Wilson Date: Sun, 21 Dec 2014 15:38:14 +0000 Subject: Add a TEST_LINE_OR macro to compare strings and execute a command if no equal. --- lib/common/Test.h | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) (limited to 'lib/common') 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 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 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); -- cgit v1.2.3