Skip to content

Commit

Permalink
testrunner: removed pointless and barely used CHECK_EQUALS and `EXP…
Browse files Browse the repository at this point in the history
…ECT_EQ`
  • Loading branch information
firewave committed Aug 17, 2024
1 parent 016782f commit 55b7b72
Show file tree
Hide file tree
Showing 3 changed files with 7 additions and 7 deletions.
6 changes: 3 additions & 3 deletions test/fixture.h
Original file line number Diff line number Diff line change
Expand Up @@ -295,11 +295,11 @@ class TestInstance {
std::unique_ptr<TestFixture> impl;
};

// 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)

// TODO: the asserts do not actually assert i.e. do stop executing the test
#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 { assertEquals(__FILE__, __LINE__, (EXPECTED), (ACTUAL)); } catch (...) { assertNoThrowFail(__FILE__, __LINE__); } } while (false)
// *INDENT-ON*
Expand All @@ -317,7 +317,7 @@ class TestInstance {
#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 ) 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; assertEquals(__FILE__, __LINE__, true, P.set(Platform::toString(T), errstr, {exename}), errstr); } while (false)
Expand Down
6 changes: 3 additions & 3 deletions test/testsuppressions.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -245,7 +245,7 @@ class TestSuppressions : public TestFixture {
if (suppression == "unusedFunction")
settings.checks.setEnabled(Checks::unusedFunction, true);
if (!suppression.empty()) {
EXPECT_EQ("", settings.supprs.nomsg.addSuppressionLine(suppression));
ASSERT_EQUALS("", settings.supprs.nomsg.addSuppressionLine(suppression));
}

std::vector<std::unique_ptr<ScopedFile>> scopedfiles;
Expand Down Expand Up @@ -288,7 +288,7 @@ class TestSuppressions : public TestFixture {
$.inlineSuppressions = true);
settings.severity.enable(Severity::information);
if (!suppression.empty()) {
EXPECT_EQ("", settings.supprs.nomsg.addSuppressionLine(suppression));
ASSERT_EQUALS("", settings.supprs.nomsg.addSuppressionLine(suppression));
}

std::vector<std::unique_ptr<ScopedFile>> scopedfiles;
Expand Down Expand Up @@ -332,7 +332,7 @@ class TestSuppressions : public TestFixture {
$.inlineSuppressions = true);
settings.severity.enable(Severity::information);
if (!suppression.empty()) {
EXPECT_EQ("", settings.supprs.nomsg.addSuppressionLine(suppression));
ASSERT_EQUALS("", settings.supprs.nomsg.addSuppressionLine(suppression));
}

std::vector<std::unique_ptr<ScopedFile>> scopedfiles;
Expand Down
2 changes: 1 addition & 1 deletion test/testvarid.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -275,7 +275,7 @@ class TestVarID : public TestFixture {
Tokenizer tokenizer(settings, *this);
std::istringstream istr(code);
ASSERT_LOC(tokenizer.list.createTokens(istr, filename), file, line);
EXPECT_EQ(true, tokenizer.simplifyTokens1(""));
ASSERT_EQUALS(true, tokenizer.simplifyTokens1(""));

// result..
Token::stringifyOptions options = Token::stringifyOptions::forDebugVarId();
Expand Down

0 comments on commit 55b7b72

Please sign in to comment.