From 016782f40d3e4855b6f2f9b397c77515644abf18 Mon Sep 17 00:00:00 2001 From: firewave Date: Fri, 16 Aug 2024 16:04:58 +0200 Subject: [PATCH] testrunner: removed unused and inconsistently used return value from `assert*()` functions --- test/fixture.cpp | 43 +++++++++++++--------------- test/fixture.h | 68 ++++++++++++++++++++++---------------------- test/testio.cpp | 40 +++++++++++++------------- test/testlibrary.cpp | 4 +-- 4 files changed, 75 insertions(+), 80 deletions(-) diff --git a/test/fixture.cpp b/test/fixture.cpp index 032056c9635a..eac9f6137635 100644 --- a/test/fixture.cpp +++ b/test/fixture.cpp @@ -162,16 +162,15 @@ static std::string writestr(const std::string &str, bool gccStyle = false) return ostr.str(); } -bool TestFixture::assert_(const char * const filename, const unsigned int linenr, const bool condition) const +void TestFixture::assert_(const char * const filename, const unsigned int linenr, const bool condition) const { if (!condition) { ++fails_counter; errmsg << getLocationStr(filename, linenr) << ": Assertion failed." << std::endl << "_____" << std::endl; } - return condition; } -void TestFixture::assertEqualsFailed(const char* const filename, const unsigned int linenr, const std::string& expected, const std::string& actual, const std::string& msg) const +void TestFixture::assertFailure(const char* const filename, const unsigned int linenr, const std::string& expected, const std::string& actual, const std::string& msg) const { ++fails_counter; errmsg << getLocationStr(filename, linenr) << ": Assertion failed. " << std::endl @@ -184,12 +183,11 @@ void TestFixture::assertEqualsFailed(const char* const filename, const unsigned errmsg << "_____" << std::endl; } -bool TestFixture::assertEquals(const char * const filename, const unsigned int linenr, const std::string &expected, const std::string &actual, const std::string &msg) const +void TestFixture::assertEquals(const char * const filename, const unsigned int linenr, const std::string &expected, const std::string &actual, const std::string &msg) const { if (expected != actual) { - assertEqualsFailed(filename, linenr, expected, actual, msg); + assertFailure(filename, linenr, expected, actual, msg); } - return expected == actual; } std::string TestFixture::deleteLineNumber(const std::string &message) @@ -216,42 +214,42 @@ std::string TestFixture::deleteLineNumber(const std::string &message) return result; } -bool TestFixture::assertEqualsWithoutLineNumbers(const char * const filename, const unsigned int linenr, const std::string &expected, const std::string &actual, const std::string &msg) const +void TestFixture::assertEqualsWithoutLineNumbers(const char * const filename, const unsigned int linenr, const std::string &expected, const std::string &actual, const std::string &msg) const { - return assertEquals(filename, linenr, deleteLineNumber(expected), deleteLineNumber(actual), msg); + assertEquals(filename, linenr, deleteLineNumber(expected), deleteLineNumber(actual), msg); } -bool TestFixture::assertEquals(const char * const filename, const unsigned int linenr, const char expected[], const std::string& actual, const std::string &msg) const +void TestFixture::assertEquals(const char * const filename, const unsigned int linenr, const char expected[], const std::string& actual, const std::string &msg) const { - return assertEquals(filename, linenr, std::string(expected), actual, msg); + assertEquals(filename, linenr, std::string(expected), actual, msg); } -bool TestFixture::assertEquals(const char * const filename, const unsigned int linenr, const char expected[], const char actual[], const std::string &msg) const + +void TestFixture::assertEquals(const char * const filename, const unsigned int linenr, const char expected[], const char actual[], const std::string &msg) const { - return assertEquals(filename, linenr, std::string(expected), std::string(actual), msg); + assertEquals(filename, linenr, std::string(expected), std::string(actual), msg); } -bool TestFixture::assertEquals(const char * const filename, const unsigned int linenr, const std::string& expected, const char actual[], const std::string &msg) const + +void TestFixture::assertEquals(const char * const filename, const unsigned int linenr, const std::string& expected, const char actual[], const std::string &msg) const { - return assertEquals(filename, linenr, expected, std::string(actual), msg); + assertEquals(filename, linenr, expected, std::string(actual), msg); } -bool TestFixture::assertEquals(const char * const filename, const unsigned int linenr, const long long expected, const long long actual, const std::string &msg) const +void TestFixture::assertEquals(const char * const filename, const unsigned int linenr, const long long expected, const long long actual, const std::string &msg) const { if (expected != actual) { - return assertEquals(filename, linenr, std::to_string(expected), std::to_string(actual), msg); + assertEquals(filename, linenr, std::to_string(expected), std::to_string(actual), msg); } - return true; } -bool TestFixture::assertEqualsDouble(const char * const filename, const unsigned int linenr, const double expected, const double actual, const double tolerance, const std::string &msg) const +void TestFixture::assertEqualsDouble(const char * const filename, const unsigned int linenr, const double expected, const double actual, const double tolerance, const std::string &msg) const { if (expected < (actual - tolerance) || expected > (actual + tolerance)) { std::ostringstream ostr1; ostr1 << expected; std::ostringstream ostr2; ostr2 << actual; - return assertEquals(filename, linenr, ostr1.str(), ostr2.str(), msg); + assertEquals(filename, linenr, ostr1.str(), ostr2.str(), msg); } - return false; } void TestFixture::todoAssertEquals(const char * const filename, const unsigned int linenr, @@ -265,7 +263,7 @@ void TestFixture::todoAssertEquals(const char * const filename, const unsigned i ++succeeded_todos_counter; } else { - (void)assertEquals(filename, linenr, current, actual); + assertEquals(filename, linenr, current, actual); ++todos_counter; } } @@ -289,7 +287,6 @@ void TestFixture::assertThrow(const char * const filename, const unsigned int li ++fails_counter; errmsg << getLocationStr(filename, linenr) << ": Assertion succeeded. " << "The expected exception was thrown" << std::endl << "_____" << std::endl; - } void TestFixture::assertThrowFail(const char * const filename, const unsigned int linenr) const @@ -297,7 +294,6 @@ void TestFixture::assertThrowFail(const char * const filename, const unsigned in ++fails_counter; errmsg << getLocationStr(filename, linenr) << ": Assertion failed. " << "The expected exception was not thrown" << std::endl << "_____" << std::endl; - } void TestFixture::assertNoThrowFail(const char * const filename, const unsigned int linenr) const @@ -322,7 +318,6 @@ void TestFixture::assertNoThrowFail(const char * const filename, const unsigned errmsg << getLocationStr(filename, linenr) << ": Assertion failed. " << "Unexpected exception was thrown: " << ex_msg << std::endl << "_____" << std::endl; - } void TestFixture::printHelp() diff --git a/test/fixture.h b/test/fixture.h index c26d20ef6960..465a249ebbfe 100644 --- a/test/fixture.h +++ b/test/fixture.h @@ -68,39 +68,35 @@ class TestFixture : public ErrorLogger { virtual void teardownTestInternal() {} std::string getLocationStr(const char * filename, unsigned int linenr) const; - bool assert_(const char * filename, unsigned int linenr, bool condition) const; + void assert_(const char * filename, unsigned int linenr, bool condition) const; template - bool assertEquals(const char* const filename, const unsigned int linenr, const T& expected, const T& actual, const std::string& msg = emptyString) const { + void assertEquals(const char* const filename, const unsigned int linenr, const T& expected, const T& actual, const std::string& msg = emptyString) const { if (expected != actual) { std::ostringstream expectedStr; expectedStr << expected; std::ostringstream actualStr; actualStr << actual; - assertEqualsFailed(filename, linenr, expectedStr.str(), actualStr.str(), msg); + assertFailure(filename, linenr, expectedStr.str(), actualStr.str(), msg); } - return expected == actual; } template - bool assertEqualsEnum(const char* const filename, const unsigned int linenr, const T& expected, const T& actual, const std::string& msg = emptyString) const { + void assertEqualsEnum(const char* const filename, const unsigned int linenr, const T& expected, const T& actual, const std::string& msg = emptyString) const { if (std::is_unsigned()) - return assertEquals(filename, linenr, static_cast(expected), static_cast(actual), msg); - return assertEquals(filename, linenr, static_cast(expected), static_cast(actual), msg); + assertEquals(filename, linenr, static_cast(expected), static_cast(actual), msg); + else + assertEquals(filename, linenr, static_cast(expected), static_cast(actual), msg); } - //Helper function to be called when an assertEquals assertion fails. - //Writes the appropriate failure message to errmsg and increments fails_counter - void assertEqualsFailed(const char* filename, unsigned int linenr, const std::string& expected, const std::string& actual, const std::string& msg) const; - - bool assertEquals(const char * filename, unsigned int linenr, const std::string &expected, const std::string &actual, const std::string &msg = emptyString) const; - bool assertEqualsWithoutLineNumbers(const char * filename, unsigned int linenr, const std::string &expected, const std::string &actual, const std::string &msg = emptyString) const; - bool assertEquals(const char * filename, unsigned int linenr, const char expected[], const std::string& actual, const std::string &msg = emptyString) const; - bool assertEquals(const char * filename, unsigned int linenr, const char expected[], const char actual[], const std::string &msg = emptyString) const; - bool assertEquals(const char * filename, unsigned int linenr, const std::string& expected, const char actual[], const std::string &msg = emptyString) const; - bool assertEquals(const char * filename, unsigned int linenr, long long expected, long long actual, const std::string &msg = emptyString) const; - bool assertEqualsDouble(const char * filename, unsigned int linenr, double expected, double actual, double tolerance, const std::string &msg = emptyString) const; + void assertEquals(const char * filename, unsigned int linenr, const std::string &expected, const std::string &actual, const std::string &msg = emptyString) const; + void assertEqualsWithoutLineNumbers(const char * filename, unsigned int linenr, const std::string &expected, const std::string &actual, const std::string &msg = emptyString) const; + void assertEquals(const char * filename, unsigned int linenr, const char expected[], const std::string& actual, const std::string &msg = emptyString) const; + void assertEquals(const char * filename, unsigned int linenr, const char expected[], const char actual[], const std::string &msg = emptyString) const; + void assertEquals(const char * filename, unsigned int linenr, const std::string& expected, const char actual[], const std::string &msg = emptyString) const; + void assertEquals(const char * filename, unsigned int linenr, long long expected, long long actual, const std::string &msg = emptyString) const; + void assertEqualsDouble(const char * filename, unsigned int linenr, double expected, double actual, double tolerance, const std::string &msg = emptyString) const; void todoAssertEquals(const char * filename, unsigned int linenr, const std::string &wanted, const std::string ¤t, const std::string &actual) const; @@ -267,6 +263,10 @@ class TestFixture : public ErrorLogger { const Settings settingsDefault; private: + //Helper function to be called when an assertEquals assertion fails. + //Writes the appropriate failure message to errmsg and increments fails_counter + void assertFailure(const char* filename, unsigned int linenr, const std::string& expected, const std::string& actual, const std::string& msg) const; + std::ostringstream mOutput; std::ostringstream mErrout; @@ -295,31 +295,31 @@ class TestInstance { std::unique_ptr impl; }; -// TODO: most asserts do not actually assert i.e. do not return +// TODO: the asserts do not actually assert i.e. do stop executing the test #define TEST_CASE( NAME ) do { if (prepareTest(#NAME)) { setVerbose(false); try { NAME(); teardownTest(); } catch (...) { assertNoThrowFail(__FILE__, __LINE__); } } } while (false) -#define ASSERT( CONDITION ) if (!assert_(__FILE__, __LINE__, (CONDITION))) return -#define ASSERT_LOC( CONDITION, FILE_, LINE_ ) (void)assert_(FILE_, LINE_, (CONDITION)) -#define CHECK_EQUALS( EXPECTED, ACTUAL ) (void)assertEquals(__FILE__, __LINE__, (EXPECTED), (ACTUAL)) +#define ASSERT( CONDITION ) assert_(__FILE__, __LINE__, (CONDITION)) +#define ASSERT_LOC( CONDITION, FILE_, LINE_ ) assert_(FILE_, LINE_, (CONDITION)) +#define CHECK_EQUALS( EXPECTED, ACTUAL ) assertEquals(__FILE__, __LINE__, (EXPECTED), (ACTUAL)) // *INDENT-OFF* -#define ASSERT_EQUALS( EXPECTED, ACTUAL ) do { try { if (!assertEquals(__FILE__, __LINE__, (EXPECTED), (ACTUAL))) return; } catch (...) { assertNoThrowFail(__FILE__, __LINE__); } } while (false) +#define ASSERT_EQUALS( EXPECTED, ACTUAL ) do { try { assertEquals(__FILE__, __LINE__, (EXPECTED), (ACTUAL)); } catch (...) { assertNoThrowFail(__FILE__, __LINE__); } } while (false) // *INDENT-ON* -#define ASSERT_EQUALS_WITHOUT_LINENUMBERS( EXPECTED, ACTUAL ) (void)assertEqualsWithoutLineNumbers(__FILE__, __LINE__, EXPECTED, ACTUAL) -#define ASSERT_EQUALS_DOUBLE( EXPECTED, ACTUAL, TOLERANCE ) (void)assertEqualsDouble(__FILE__, __LINE__, EXPECTED, ACTUAL, TOLERANCE) -#define ASSERT_EQUALS_LOC_MSG( EXPECTED, ACTUAL, MSG, FILE_, LINE_ ) (void)assertEquals(FILE_, LINE_, EXPECTED, ACTUAL, MSG) -#define ASSERT_EQUALS_MSG( EXPECTED, ACTUAL, MSG ) (void)assertEquals(__FILE__, __LINE__, EXPECTED, ACTUAL, MSG) -#define ASSERT_EQUALS_ENUM( EXPECTED, ACTUAL ) if (!assertEqualsEnum(__FILE__, __LINE__, (EXPECTED), (ACTUAL))) return +#define ASSERT_EQUALS_WITHOUT_LINENUMBERS( EXPECTED, ACTUAL ) assertEqualsWithoutLineNumbers(__FILE__, __LINE__, EXPECTED, ACTUAL) +#define ASSERT_EQUALS_DOUBLE( EXPECTED, ACTUAL, TOLERANCE ) assertEqualsDouble(__FILE__, __LINE__, EXPECTED, ACTUAL, TOLERANCE) +#define ASSERT_EQUALS_LOC_MSG( EXPECTED, ACTUAL, MSG, FILE_, LINE_ ) assertEquals(FILE_, LINE_, EXPECTED, ACTUAL, MSG) +#define ASSERT_EQUALS_MSG( EXPECTED, ACTUAL, MSG ) assertEquals(__FILE__, __LINE__, EXPECTED, ACTUAL, MSG) +#define ASSERT_EQUALS_ENUM( EXPECTED, ACTUAL ) assertEqualsEnum(__FILE__, __LINE__, (EXPECTED), (ACTUAL)) #define ASSERT_THROW( CMD, EXCEPTION ) do { try { (void)(CMD); assertThrowFail(__FILE__, __LINE__); } catch (const EXCEPTION&) {} catch (...) { assertThrowFail(__FILE__, __LINE__); } } while (false) -#define ASSERT_THROW_EQUALS( CMD, EXCEPTION, EXPECTED ) do { try { (void)(CMD); assertThrowFail(__FILE__, __LINE__); } catch (const EXCEPTION&e) { (void)assertEquals(__FILE__, __LINE__, EXPECTED, e.errorMessage); } catch (...) { assertThrowFail(__FILE__, __LINE__); } } while (false) -#define ASSERT_THROW_EQUALS_2( CMD, EXCEPTION, EXPECTED ) do { try { (void)(CMD); assertThrowFail(__FILE__, __LINE__); } catch (const EXCEPTION&e) { (void)assertEquals(__FILE__, __LINE__, EXPECTED, e.what()); } catch (...) { assertThrowFail(__FILE__, __LINE__); } } while (false) -#define ASSERT_THROW_INTERNAL( CMD, TYPE ) do { try { (void)(CMD); assertThrowFail(__FILE__, __LINE__); } catch (const InternalError& e) { (void)assertEqualsEnum(__FILE__, __LINE__, InternalError::TYPE, e.type); } catch (...) { assertThrowFail(__FILE__, __LINE__); } } while (false) -#define ASSERT_THROW_INTERNAL_EQUALS( CMD, TYPE, EXPECTED ) do { try { (void)(CMD); assertThrowFail(__FILE__, __LINE__); } catch (const InternalError& e) { (void)assertEqualsEnum(__FILE__, __LINE__, InternalError::TYPE, e.type); (void)assertEquals(__FILE__, __LINE__, EXPECTED, e.errorMessage); } catch (...) { assertThrowFail(__FILE__, __LINE__); } } while (false) +#define ASSERT_THROW_EQUALS( CMD, EXCEPTION, EXPECTED ) do { try { (void)(CMD); assertThrowFail(__FILE__, __LINE__); } catch (const EXCEPTION&e) { assertEquals(__FILE__, __LINE__, EXPECTED, e.errorMessage); } catch (...) { assertThrowFail(__FILE__, __LINE__); } } while (false) +#define ASSERT_THROW_EQUALS_2( CMD, EXCEPTION, EXPECTED ) do { try { (void)(CMD); assertThrowFail(__FILE__, __LINE__); } catch (const EXCEPTION&e) { assertEquals(__FILE__, __LINE__, EXPECTED, e.what()); } catch (...) { assertThrowFail(__FILE__, __LINE__); } } while (false) +#define ASSERT_THROW_INTERNAL( CMD, TYPE ) do { try { (void)(CMD); assertThrowFail(__FILE__, __LINE__); } catch (const InternalError& e) { assertEqualsEnum(__FILE__, __LINE__, InternalError::TYPE, e.type); } catch (...) { assertThrowFail(__FILE__, __LINE__); } } while (false) +#define ASSERT_THROW_INTERNAL_EQUALS( CMD, TYPE, EXPECTED ) do { try { (void)(CMD); assertThrowFail(__FILE__, __LINE__); } catch (const InternalError& e) { assertEqualsEnum(__FILE__, __LINE__, InternalError::TYPE, e.type); assertEquals(__FILE__, __LINE__, EXPECTED, e.errorMessage); } catch (...) { assertThrowFail(__FILE__, __LINE__); } } while (false) #define ASSERT_NO_THROW( CMD ) do { try { (void)(CMD); } catch (...) { assertNoThrowFail(__FILE__, __LINE__); } } while (false) #define TODO_ASSERT_THROW( CMD, EXCEPTION ) do { try { (void)(CMD); } catch (const EXCEPTION&) {} catch (...) { assertThrow(__FILE__, __LINE__); } } while (false) #define TODO_ASSERT( CONDITION ) do { const bool condition=(CONDITION); todoAssertEquals(__FILE__, __LINE__, true, false, condition); } while (false) #define TODO_ASSERT_EQUALS( WANTED, CURRENT, ACTUAL ) todoAssertEquals(__FILE__, __LINE__, WANTED, CURRENT, ACTUAL) -#define EXPECT_EQ( EXPECTED, ACTUAL ) (void)assertEquals(__FILE__, __LINE__, EXPECTED, ACTUAL) +#define EXPECT_EQ( EXPECTED, ACTUAL ) assertEquals(__FILE__, __LINE__, EXPECTED, ACTUAL) #define REGISTER_TEST( CLASSNAME ) namespace { class CLASSNAME ## Instance : public TestInstance { public: CLASSNAME ## Instance() : TestInstance(#CLASSNAME) {} TestFixture* create() override { impl.reset(new CLASSNAME); return impl.get(); } }; CLASSNAME ## Instance instance_ ## CLASSNAME; } -#define PLATFORM( P, T ) do { std::string errstr; (void)assertEquals(__FILE__, __LINE__, true, P.set(Platform::toString(T), errstr, {exename}), errstr); } while (false) +#define PLATFORM( P, T ) do { std::string errstr; assertEquals(__FILE__, __LINE__, true, P.set(Platform::toString(T), errstr, {exename}), errstr); } while (false) #endif // fixtureH diff --git a/test/testio.cpp b/test/testio.cpp index f8318c3c1c8b..0f21343ff166 100644 --- a/test/testio.cpp +++ b/test/testio.cpp @@ -831,13 +831,13 @@ class TestIO : public TestFixture { void testFormatStrNoWarn(const char *filename, unsigned int linenr, const char (&code)[size], bool cpp = false) { check(code, dinit(CheckOptions, $.inconclusive = true, $.platform = Platform::Type::Unix32, $.onlyFormatStr = true, $.cpp = cpp)); - (void)assertEquals(filename, linenr, emptyString, errout_str()); + assertEquals(filename, linenr, emptyString, errout_str()); check(code, dinit(CheckOptions, $.inconclusive = true, $.platform = Platform::Type::Unix64, $.onlyFormatStr = true, $.cpp = cpp)); - (void)assertEquals(filename, linenr, emptyString, errout_str()); + assertEquals(filename, linenr, emptyString, errout_str()); check(code, dinit(CheckOptions, $.inconclusive = true, $.platform = Platform::Type::Win32A, $.onlyFormatStr = true, $.cpp = cpp)); - (void)assertEquals(filename, linenr, emptyString, errout_str()); + assertEquals(filename, linenr, emptyString, errout_str()); check(code, dinit(CheckOptions, $.inconclusive = true, $.platform = Platform::Type::Win64, $.onlyFormatStr = true, $.cpp = cpp)); - (void)assertEquals(filename, linenr, emptyString, errout_str()); + assertEquals(filename, linenr, emptyString, errout_str()); } template @@ -845,13 +845,13 @@ class TestIO : public TestFixture { const char (&code)[size], const char* testScanfErrString, bool cpp = false) { check(code, dinit(CheckOptions, $.inconclusive = true, $.platform = Platform::Type::Unix32, $.onlyFormatStr = true, $.cpp = cpp)); - (void)assertEquals(filename, linenr, testScanfErrString, errout_str()); + assertEquals(filename, linenr, testScanfErrString, errout_str()); check(code, dinit(CheckOptions, $.inconclusive = true, $.platform = Platform::Type::Unix64, $.onlyFormatStr = true, $.cpp = cpp)); - (void)assertEquals(filename, linenr, testScanfErrString, errout_str()); + assertEquals(filename, linenr, testScanfErrString, errout_str()); check(code, dinit(CheckOptions, $.inconclusive = true, $.platform = Platform::Type::Win32A, $.onlyFormatStr = true, $.cpp = cpp)); - (void)assertEquals(filename, linenr, testScanfErrString, errout_str()); + assertEquals(filename, linenr, testScanfErrString, errout_str()); check(code, dinit(CheckOptions, $.inconclusive = true, $.platform = Platform::Type::Win64, $.onlyFormatStr = true, $.cpp = cpp)); - (void)assertEquals(filename, linenr, testScanfErrString, errout_str()); + assertEquals(filename, linenr, testScanfErrString, errout_str()); } template @@ -859,13 +859,13 @@ class TestIO : public TestFixture { const char (&code)[size], const char* testScanfErrAkaString, const char* testScanfErrAkaWin64String, bool cpp = false) { check(code, dinit(CheckOptions, $.inconclusive = true, $.portability = true, $.platform = Platform::Type::Unix32, $.onlyFormatStr = true, $.cpp = cpp)); - (void)assertEquals(filename, linenr, testScanfErrAkaString, errout_str()); + assertEquals(filename, linenr, testScanfErrAkaString, errout_str()); check(code, dinit(CheckOptions, $.inconclusive = true, $.portability = true, $.platform = Platform::Type::Unix64, $.onlyFormatStr = true, $.cpp = cpp)); - (void)assertEquals(filename, linenr, testScanfErrAkaString, errout_str()); + assertEquals(filename, linenr, testScanfErrAkaString, errout_str()); check(code, dinit(CheckOptions, $.inconclusive = true, $.portability = true, $.platform = Platform::Type::Win32A, $.onlyFormatStr = true, $.cpp = cpp)); - (void)assertEquals(filename, linenr, testScanfErrAkaString, errout_str()); + assertEquals(filename, linenr, testScanfErrAkaString, errout_str()); check(code, dinit(CheckOptions, $.inconclusive = true, $.portability = true, $.platform = Platform::Type::Win64, $.onlyFormatStr = true, $.cpp = cpp)); - (void)assertEquals(filename, linenr, testScanfErrAkaWin64String, errout_str()); + assertEquals(filename, linenr, testScanfErrAkaWin64String, errout_str()); } template @@ -873,13 +873,13 @@ class TestIO : public TestFixture { const char (&code)[size], const char* testScanfErrAkaWin64String, bool cpp = false) { check(code, dinit(CheckOptions, $.inconclusive = true, $.portability = true, $.platform = Platform::Type::Unix32, $.onlyFormatStr = true, $.cpp = cpp)); - (void)assertEquals(filename, linenr, emptyString, errout_str()); + assertEquals(filename, linenr, emptyString, errout_str()); check(code, dinit(CheckOptions, $.inconclusive = true, $.portability = true, $.platform = Platform::Type::Unix64, $.onlyFormatStr = true, $.cpp = cpp)); - (void)assertEquals(filename, linenr, emptyString, errout_str()); + assertEquals(filename, linenr, emptyString, errout_str()); check(code, dinit(CheckOptions, $.inconclusive = true, $.portability = true, $.platform = Platform::Type::Win32A, $.onlyFormatStr = true, $.cpp = cpp)); - (void)assertEquals(filename, linenr, emptyString, errout_str()); + assertEquals(filename, linenr, emptyString, errout_str()); check(code, dinit(CheckOptions, $.inconclusive = true, $.portability = true, $.platform = Platform::Type::Win64, $.onlyFormatStr = true, $.cpp = cpp)); - (void)assertEquals(filename, linenr, testScanfErrAkaWin64String, errout_str()); + assertEquals(filename, linenr, testScanfErrAkaWin64String, errout_str()); } template @@ -887,13 +887,13 @@ class TestIO : public TestFixture { const char (&code)[size], const char* testScanfErrAkaString, bool cpp = false) { check(code, dinit(CheckOptions, $.inconclusive = true, $.portability = true, $.platform = Platform::Type::Unix32, $.onlyFormatStr = true, $.cpp = cpp)); - (void)assertEquals(filename, linenr, testScanfErrAkaString, errout_str()); + assertEquals(filename, linenr, testScanfErrAkaString, errout_str()); check(code, dinit(CheckOptions, $.inconclusive = true, $.portability = true, $.platform = Platform::Type::Unix64, $.onlyFormatStr = true, $.cpp = cpp)); - (void)assertEquals(filename, linenr, testScanfErrAkaString, errout_str()); + assertEquals(filename, linenr, testScanfErrAkaString, errout_str()); check(code, dinit(CheckOptions, $.inconclusive = true, $.portability = true, $.platform = Platform::Type::Win32A, $.onlyFormatStr = true, $.cpp = cpp)); - (void)assertEquals(filename, linenr, testScanfErrAkaString, errout_str()); + assertEquals(filename, linenr, testScanfErrAkaString, errout_str()); check(code, dinit(CheckOptions, $.inconclusive = true, $.portability = true, $.platform = Platform::Type::Win64, $.onlyFormatStr = true, $.cpp = cpp)); - (void)assertEquals(filename, linenr, emptyString, errout_str()); + assertEquals(filename, linenr, emptyString, errout_str()); } #define TEST_SCANF_NOWARN(FORMAT, FORMATSTR, TYPE) \ diff --git a/test/testlibrary.cpp b/test/testlibrary.cpp index 6cdabd7f9b19..e59086b940bf 100644 --- a/test/testlibrary.cpp +++ b/test/testlibrary.cpp @@ -1020,8 +1020,8 @@ class TestLibrary : public TestFixture { void loadLibError(const char (&xmldata)[size], Library::ErrorCode errorcode, const char* file, unsigned line) const { Library library; Library::Error liberr; - (void)assertEquals(file, line, true, LibraryHelper::loadxmldata(library, liberr, xmldata, size-1)); - (void)assertEquals(file, line, true, errorcode == liberr.errorcode); + assertEquals(file, line, true, LibraryHelper::loadxmldata(library, liberr, xmldata, size-1)); + assertEquals(file, line, true, errorcode == liberr.errorcode); } #define LOADLIB_ERROR_INVALID_RANGE(valid) LOADLIBERROR("\n" \