From 40d2067dc44c9d46fc1f83c41fe4187a70f23bce Mon Sep 17 00:00:00 2001 From: David Robillard Date: Mon, 22 Apr 2019 11:50:34 +0200 Subject: Simplify unit tests and improve coverage by using assert --- test/symbol_test.cpp | 19 ++++++++----------- 1 file changed, 8 insertions(+), 11 deletions(-) (limited to 'test/symbol_test.cpp') diff --git a/test/symbol_test.cpp b/test/symbol_test.cpp index 4af598b..7cb6666 100644 --- a/test/symbol_test.cpp +++ b/test/symbol_test.cpp @@ -1,6 +1,6 @@ /* This file is part of Raul. - Copyright 2007-2012 David Robillard + Copyright 2007-2019 David Robillard Raul is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software @@ -14,8 +14,11 @@ along with Raul. If not, see . */ +#undef NDEBUG + #include "raul/Symbol.hpp" +#include #include #include #include @@ -25,12 +28,6 @@ main() { using Symbol = Raul::Symbol; -#define CHECK(cond) \ - do { if (!(cond)) { \ - std::cerr << "Test failed: " << (cond) << std::endl; \ - return 1; \ - } } while (0) - std::list names; names.emplace_back("Dry/Wet Balance"); names.emplace_back("foo+1bar(baz)"); @@ -47,11 +44,11 @@ main() names.emplace_back(""); for (const auto& name : names) { - CHECK(!Symbol::symbolify(name).empty()); + assert(!Symbol::symbolify(name).empty()); } Symbol original("sym"); - CHECK(original == Symbol(original)); + assert(original == Symbol(original)); bool valid = true; try { @@ -60,7 +57,7 @@ main() std::cerr << "Caught exception: " << e.what() << std::endl; valid = false; } - CHECK(!valid); + assert(!valid); valid = true; try { @@ -69,7 +66,7 @@ main() std::cerr << "Caught exception: " << e.what() << std::endl; valid = false; } - CHECK(!valid); + assert(!valid); return 0; } -- cgit v1.2.1