From 0865eb3a8050e87fe2d3195b5eb5acf21a3fb62a Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Ion=20Gazta=C3=B1aga?= Date: Fri, 20 Jan 2023 12:44:30 +0100 Subject: [PATCH] Use lightweight test instead of assert --- test/conversion_test.cpp | 119 ++++++++++++++++++++------------------- 1 file changed, 60 insertions(+), 59 deletions(-) diff --git a/test/conversion_test.cpp b/test/conversion_test.cpp index 8e901f8..147356a 100644 --- a/test/conversion_test.cpp +++ b/test/conversion_test.cpp @@ -13,6 +13,7 @@ #include #include #include +#include enum ConstructionType { Copied, Moved, Other }; @@ -188,42 +189,42 @@ int main() { conversion_target x; c.push_back(x); - assert(c.construction_type() == Copied); + BOOST_TEST(c.construction_type() == Copied); c.insert(c.begin(), x); - assert(c.construction_type() == Copied); + BOOST_TEST(c.construction_type() == Copied); } { const conversion_target x; c.push_back(x); - assert(c.construction_type() == Copied); + BOOST_TEST(c.construction_type() == Copied); c.insert(c.begin(), x); - assert(c.construction_type() == Copied); + BOOST_TEST(c.construction_type() == Copied); } { c.push_back(conversion_target()); - assert(c.construction_type() == Copied); + BOOST_TEST(c.construction_type() == Copied); c.insert(c.begin(), conversion_target()); - assert(c.construction_type() == Copied); + BOOST_TEST(c.construction_type() == Copied); } { conversion_source x; c.push_back(x); - assert(c.construction_type() == Copied); + BOOST_TEST(c.construction_type() == Copied); c.insert(c.begin(), x); - assert(c.construction_type() == Copied); + BOOST_TEST(c.construction_type() == Copied); } { const conversion_source x; c.push_back(x); - assert(c.construction_type() == Copied); + BOOST_TEST(c.construction_type() == Copied); c.insert(c.begin(), x); - assert(c.construction_type() == Copied); + BOOST_TEST(c.construction_type() == Copied); } { c.push_back(conversion_source()); - assert(c.construction_type() == Copied); + BOOST_TEST(c.construction_type() == Copied); c.insert(c.begin(), conversion_source()); - assert(c.construction_type() == Copied); + BOOST_TEST(c.construction_type() == Copied); } } @@ -232,42 +233,42 @@ int main() { conversion_target_copymovable x; c.push_back(x); - assert(c.construction_type() == Copied); + BOOST_TEST(c.construction_type() == Copied); c.insert(c.begin(), x); - assert(c.construction_type() == Copied); + BOOST_TEST(c.construction_type() == Copied); } { const conversion_target_copymovable x; c.push_back(x); - assert(c.construction_type() == Copied); + BOOST_TEST(c.construction_type() == Copied); c.insert(c.begin(), x); - assert(c.construction_type() == Copied); + BOOST_TEST(c.construction_type() == Copied); } { c.push_back(conversion_target_copymovable()); - assert(c.construction_type() == Moved); + BOOST_TEST(c.construction_type() == Moved); c.insert(c.begin(), conversion_target_copymovable()); - assert(c.construction_type() == Moved); + BOOST_TEST(c.construction_type() == Moved); } { conversion_source x; c.push_back(x); - assert(c.construction_type() == Moved); + BOOST_TEST(c.construction_type() == Moved); c.insert(c.begin(), x); - assert(c.construction_type() == Moved); + BOOST_TEST(c.construction_type() == Moved); } { const conversion_source x; c.push_back(x); - assert(c.construction_type() == Moved); + BOOST_TEST(c.construction_type() == Moved); c.insert(c.begin(), x); - assert(c.construction_type() == Moved); + BOOST_TEST(c.construction_type() == Moved); } { c.push_back(conversion_source()); - assert(c.construction_type() == Moved); + BOOST_TEST(c.construction_type() == Moved); c.insert(c.begin(), conversion_source()); - assert(c.construction_type() == Moved); + BOOST_TEST(c.construction_type() == Moved); } } { @@ -276,38 +277,38 @@ int main() //{ // conversion_target_movable x; // c.push_back(x); - // assert(c.construction_type() == Copied); + // BOOST_TEST(c.construction_type() == Copied); //} //{ // const conversion_target_movable x; // c.push_back(x); - // assert(c.construction_type() == Copied); + // BOOST_TEST(c.construction_type() == Copied); //} { c.push_back(conversion_target_movable()); - assert(c.construction_type() == Moved); + BOOST_TEST(c.construction_type() == Moved); c.insert(c.begin(), conversion_target_movable()); - assert(c.construction_type() == Moved); + BOOST_TEST(c.construction_type() == Moved); } { conversion_source x; c.push_back(x); - assert(c.construction_type() == Moved); + BOOST_TEST(c.construction_type() == Moved); c.insert(c.begin(), x); - assert(c.construction_type() == Moved); + BOOST_TEST(c.construction_type() == Moved); } { const conversion_source x; c.push_back(x); - assert(c.construction_type() == Moved); + BOOST_TEST(c.construction_type() == Moved); c.insert(c.begin(), x); - assert(c.construction_type() == Moved); + BOOST_TEST(c.construction_type() == Moved); } { c.push_back(conversion_source()); - assert(c.construction_type() == Moved); + BOOST_TEST(c.construction_type() == Moved); c.insert(c.begin(), conversion_source()); - assert(c.construction_type() == Moved); + BOOST_TEST(c.construction_type() == Moved); } } { @@ -315,43 +316,43 @@ int main() { int x = 0; c.push_back(x); - assert(c.construction_type() == Copied); + BOOST_TEST(c.construction_type() == Copied); c.insert(c.begin(), c.construction_type()); - assert(c.construction_type() == Copied); + BOOST_TEST(c.construction_type() == Copied); } { const int x = 0; c.push_back(x); - assert(c.construction_type() == Copied); + BOOST_TEST(c.construction_type() == Copied); c.insert(c.begin(), x); - assert(c.construction_type() == Copied); + BOOST_TEST(c.construction_type() == Copied); } { c.push_back(int(0)); - assert(c.construction_type() == Copied); + BOOST_TEST(c.construction_type() == Copied); c.insert(c.begin(), int(0)); - assert(c.construction_type() == Copied); + BOOST_TEST(c.construction_type() == Copied); } { conversion_source x; c.push_back(x); - assert(c.construction_type() == Copied); + BOOST_TEST(c.construction_type() == Copied); c.insert(c.begin(), x); - assert(c.construction_type() == Copied); + BOOST_TEST(c.construction_type() == Copied); } { const conversion_source x; c.push_back(x); - assert(c.construction_type() == Copied); + BOOST_TEST(c.construction_type() == Copied); c.insert(c.begin(), x); - assert(c.construction_type() == Copied); + BOOST_TEST(c.construction_type() == Copied); } { c.push_back(conversion_source()); - assert(c.construction_type() == Copied); + BOOST_TEST(c.construction_type() == Copied); c.insert(c.begin(), conversion_source()); - assert(c.construction_type() == Copied); + BOOST_TEST(c.construction_type() == Copied); } //c.insert(c.begin(), c.begin()); } @@ -361,43 +362,43 @@ int main() { int x = 0; c.push_back(x); - assert(c.construction_type() == Copied); + BOOST_TEST(c.construction_type() == Copied); c.insert(c.begin(), c.construction_type()); - assert(c.construction_type() == Copied); + BOOST_TEST(c.construction_type() == Copied); } { const int x = 0; c.push_back(x); - assert(c.construction_type() == Copied); + BOOST_TEST(c.construction_type() == Copied); c.insert(c.begin(), x); - assert(c.construction_type() == Copied); + BOOST_TEST(c.construction_type() == Copied); } { c.push_back(int(0)); - assert(c.construction_type() == Copied); + BOOST_TEST(c.construction_type() == Copied); c.insert(c.begin(), int(0)); - assert(c.construction_type() == Copied); + BOOST_TEST(c.construction_type() == Copied); } { conversion_source x; c.push_back(x); - assert(c.construction_type() == Copied); + BOOST_TEST(c.construction_type() == Copied); c.insert(c.begin(), x); - assert(c.construction_type() == Copied); + BOOST_TEST(c.construction_type() == Copied); } { const conversion_source x; c.push_back(x); - assert(c.construction_type() == Copied); + BOOST_TEST(c.construction_type() == Copied); c.insert(c.begin(), x); - assert(c.construction_type() == Copied); + BOOST_TEST(c.construction_type() == Copied); } { c.push_back(conversion_source()); - assert(c.construction_type() == Copied); + BOOST_TEST(c.construction_type() == Copied); c.insert(c.begin(), conversion_source()); - assert(c.construction_type() == Copied); + BOOST_TEST(c.construction_type() == Copied); } c.insert(c.begin(), c.begin()); } @@ -410,5 +411,5 @@ int main() c.container_.insert(c.container_.begin(), c.container_.begin()); } - return 0; + return boost::report_errors(); }