From 5bed656f05b25c858687fd4ca13df97b365b7d81 Mon Sep 17 00:00:00 2001 From: Dan Goodliffe Date: Sat, 16 Jun 2018 15:12:41 +0100 Subject: Use check, not require in CTF tests --- .../unittests/testCompileTimeFormatter.cpp | 52 +++++++++++----------- 1 file changed, 26 insertions(+), 26 deletions(-) diff --git a/libadhocutil/unittests/testCompileTimeFormatter.cpp b/libadhocutil/unittests/testCompileTimeFormatter.cpp index 030dbc9..9089243 100644 --- a/libadhocutil/unittests/testCompileTimeFormatter.cpp +++ b/libadhocutil/unittests/testCompileTimeFormatter.cpp @@ -78,135 +78,135 @@ BOOST_FIXTURE_TEST_SUITE( TestStreamWrite, std::stringstream ) BOOST_AUTO_TEST_CASE ( empty ) { Formatter::write(*this); - BOOST_REQUIRE(this->str().empty()); + BOOST_CHECK(this->str().empty()); } BOOST_AUTO_TEST_CASE ( single ) { Formatter::write(*this); - BOOST_REQUIRE_EQUAL(this->str(), "1"); + BOOST_CHECK_EQUAL(this->str(), "1"); } BOOST_AUTO_TEST_CASE ( start ) { Formatter::write(*this, 10); - BOOST_REQUIRE_EQUAL(this->str(), "10 after"); + BOOST_CHECK_EQUAL(this->str(), "10 after"); } BOOST_AUTO_TEST_CASE ( end ) { Formatter::write(*this, 10); - BOOST_REQUIRE_EQUAL(this->str(), "before 10"); + BOOST_CHECK_EQUAL(this->str(), "before 10"); } BOOST_AUTO_TEST_CASE ( lonely ) { Formatter::write(*this, 10); - BOOST_REQUIRE_EQUAL(this->str(), "10"); + BOOST_CHECK_EQUAL(this->str(), "10"); } BOOST_AUTO_TEST_CASE ( literal ) { Formatter::write(*this); - BOOST_REQUIRE_EQUAL(this->str(), "literal"); + BOOST_CHECK_EQUAL(this->str(), "literal"); } BOOST_AUTO_TEST_CASE ( singleInt ) { Formatter::write(*this, 32); - BOOST_REQUIRE_EQUAL(this->str(), "single 32."); + BOOST_CHECK_EQUAL(this->str(), "single 32."); } BOOST_AUTO_TEST_CASE ( singleIntReturn ) { - BOOST_REQUIRE_EQUAL(Formatter::write(*this, 32).str(), "single 32."); + BOOST_CHECK_EQUAL(Formatter::write(*this, 32).str(), "single 32."); } BOOST_AUTO_TEST_CASE ( singleDouble ) { Formatter::write(*this, 3.14); - BOOST_REQUIRE_EQUAL(this->str(), "single 3.14."); + BOOST_CHECK_EQUAL(this->str(), "single 3.14."); } BOOST_AUTO_TEST_CASE ( singlePath ) { boost::filesystem::path p("/tmp/test/path"); Formatter::write(*this, p); - BOOST_REQUIRE_EQUAL(this->str(), R"(single "/tmp/test/path".)"); + BOOST_CHECK_EQUAL(this->str(), R"(single "/tmp/test/path".)"); } BOOST_AUTO_TEST_CASE ( multi ) { Formatter::write(*this, "one", "two"); - BOOST_REQUIRE_EQUAL(this->str(), "First one, then two."); + BOOST_CHECK_EQUAL(this->str(), "First one, then two."); } BOOST_AUTO_TEST_CASE ( escape1 ) { Formatter::write(*this); - BOOST_REQUIRE_EQUAL(this->str(), "literal % percentage."); + BOOST_CHECK_EQUAL(this->str(), "literal % percentage."); } BOOST_AUTO_TEST_CASE ( escape2 ) { Formatter::write(*this); - BOOST_REQUIRE_EQUAL(this->str(), "literal %? percentage."); + BOOST_CHECK_EQUAL(this->str(), "literal %? percentage."); } BOOST_AUTO_TEST_CASE ( escape3 ) { Formatter::write(*this, 3); - BOOST_REQUIRE_EQUAL(this->str(), "literal %3 percentage."); + BOOST_CHECK_EQUAL(this->str(), "literal %3 percentage."); } BOOST_AUTO_TEST_CASE ( escape4 ) { Formatter::write(*this, 3); - BOOST_REQUIRE_EQUAL(this->str(), "literal %3% percentage."); + BOOST_CHECK_EQUAL(this->str(), "literal %3% percentage."); } BOOST_AUTO_TEST_CASE ( customBracketted ) { Formatter::write(*this, "expr"); - BOOST_REQUIRE_EQUAL(this->str(), "custom -( expr )-"); + BOOST_CHECK_EQUAL(this->str(), "custom -( expr )-"); } BOOST_AUTO_TEST_CASE ( customLongName ) { Formatter::write(*this, "some text here"); - BOOST_REQUIRE_EQUAL(this->str(), "custom ---( some text here )---"); + BOOST_CHECK_EQUAL(this->str(), "custom ---( some text here )---"); } BOOST_AUTO_TEST_CASE ( customParam1 ) { Formatter::write(*this, "some text here"); - BOOST_REQUIRE_EQUAL(this->str(), "custom ---( some text here )---"); + BOOST_CHECK_EQUAL(this->str(), "custom ---( some text here )---"); } BOOST_AUTO_TEST_CASE ( customParam2 ) { Formatter::write(*this, "some text here"); - BOOST_REQUIRE_EQUAL(this->str(), "custom ---------( some text here )---------"); + BOOST_CHECK_EQUAL(this->str(), "custom ---------( some text here )---------"); } typedef Formatter TestFormat; BOOST_AUTO_TEST_CASE ( typedefFormat ) { TestFormat::write(*this, "expr"); - BOOST_REQUIRE_EQUAL(this->str(), "custom -( expr )-"); + BOOST_CHECK_EQUAL(this->str(), "custom -( expr )-"); } AdHocFormatter(TypedefWrapper, "Typedef wrapper %?."); BOOST_AUTO_TEST_CASE ( typedefWrapper ) { TypedefWrapper::write(*this, "expr"); - BOOST_REQUIRE_EQUAL(this->str(), "Typedef wrapper expr."); + BOOST_CHECK_EQUAL(this->str(), "Typedef wrapper expr."); } BOOST_AUTO_TEST_CASE ( longFormatString ) { Formatter::write(*this); - BOOST_REQUIRE_EQUAL(this->str().length(), 246); + BOOST_CHECK_EQUAL(this->str().length(), 246); } BOOST_AUTO_TEST_SUITE_END(); @@ -218,14 +218,14 @@ BOOST_AUTO_TEST_CASE ( customMultiArgRightAlign ) Formatter::write(buf1, width, "something"); Formatter::write(buf2, width, "something else"); Formatter::write(buf3, width, 123.45); - BOOST_REQUIRE_EQUAL(buf1.str(), "value something"); - BOOST_REQUIRE_EQUAL(buf2.str(), "value something else"); - BOOST_REQUIRE_EQUAL(buf3.str(), "value 123.45"); + BOOST_CHECK_EQUAL(buf1.str(), "value something"); + BOOST_CHECK_EQUAL(buf2.str(), "value something else"); + BOOST_CHECK_EQUAL(buf3.str(), "value 123.45"); } BOOST_AUTO_TEST_CASE ( get ) { auto s = Formatter::get(20, "something else"); - BOOST_REQUIRE_EQUAL(s, "value something else"); + BOOST_CHECK_EQUAL(s, "value something else"); } -- cgit v1.2.3