Skip to content

Commit

Permalink
Restructure test files in prep for additional categories, increase cov
Browse files Browse the repository at this point in the history
Increase patch coverage where it was lacking for #27, #94, and #8.
Added new tests so all assertions are now covered, and added negative
 testing for all assertions.

Restructure Assertions test files so there's a paradigm for adding
 new assertion categories.
Updated CMake build to take this into account.
  • Loading branch information
eljonny committed Feb 28, 2025
1 parent be1af59 commit 0c5ba8b
Show file tree
Hide file tree
Showing 8 changed files with 416 additions and 101 deletions.
2 changes: 1 addition & 1 deletion cmake/Targets.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,7 @@ if (BUILD_TESTING)

add_executable (
${PROJECT_NAME}_Assertions_test
test/src/Assertions/AssertionsTests.cpp
test/src/Assertions/BasicAssertionsTests.cpp
test/src/TestCPPAssertionsMain.cpp
)

Expand Down
33 changes: 0 additions & 33 deletions test/include/Assertions/AssertionsSuite.h

This file was deleted.

101 changes: 101 additions & 0 deletions test/include/Assertions/AssertionsSuites.h
Original file line number Diff line number Diff line change
@@ -0,0 +1,101 @@
#ifndef TESTCPP_ASSERTIONS_SUITE_
#define TESTCPP_ASSERTIONS_SUITE_

#include "BasicAssertionsTests.h"

namespace TestCPP {
namespace Testing {
namespace AssertionsSuites {
TestSuite basicSuite(
"TestCPP Basic Assertions Tests",

make_tuple(
"Basic Assertion - assertEquals Test",
function<void()>(AssertionsTests::TestAssertEquals)
),
make_tuple(
"Basic Assertion - assertEquals Not Equal Test",
function<void()>(AssertionsTests::TestAssertEqualsNotEqual)
),
make_tuple(
"Basic Assertion - assertEquals C Strings Test",
function<void()>(AssertionsTests::TestAssertEqualsCStrings)
),
make_tuple(
"Basic Assertion - assertEquals C Strings Not Equal Test",
function<void()>(AssertionsTests::TestAssertEqualsCStringsNotEqual)
),
make_tuple(
"Basic Assertion - assertNotEquals Test",
function<void()>(AssertionsTests::TestAssertNotEquals)
),
make_tuple(
"Basic Assertion - assertNotEquals Equal Test",
function<void()>(AssertionsTests::TestAssertNotEqualsEqual)
),
make_tuple(
"Basic Assertion - assertNotEquals C Strings Test",
function<void()>(AssertionsTests::TestAssertNotEqualsCStrings)
),
make_tuple(
"Basic Assertion - assertNotEquals C Strings Equal Test",
function<void()>(AssertionsTests::TestAssertNotEqualsCStringsEqual)
),
make_tuple(
"Basic Assertion - assertNull Test",
function<void()>(AssertionsTests::TestAssertNull)
),
make_tuple(
"Basic Assertion - assertNull not null Test",
function<void()>(AssertionsTests::TestAssertNullNotNull)
),
make_tuple(
"Basic Assertion - assertNotNull Test",
function<void()>(AssertionsTests::TestAssertNotNull)
),
make_tuple(
"Basic Assertion - assertNotNull null Test",
function<void()>(AssertionsTests::TestAssertNotNullNull)
),
make_tuple(
"Basic Assertion - assertThrows Test",
function<void()>(AssertionsTests::TestAssertThrows)
),
make_tuple(
"Basic Assertion - assertThrows Does Not Throw Test",
function<void()>(AssertionsTests::TestAssertThrowsDoesNotThrow)
),
make_tuple(
"Basic Assertion - assertNoThrows Test",
function<void()>(AssertionsTests::TestAssertNoThrows)
),
make_tuple(
"Basic Assertion - assertNoThrows Throws Test",
function<void()>(AssertionsTests::TestAssertNoThrowsThrows)
),
make_tuple(
"Basic Assertion - assertTrue Test",
function<void()>(AssertionsTests::TestAssertTrue)
),
make_tuple(
"Basic Assertion - assertTrue not true Test",
function<void()>(AssertionsTests::TestAssertTrueNotTrue)
),
make_tuple(
"Basic Assertion - assertFalse Test",
function<void()>(AssertionsTests::TestAssertFalse)
),
make_tuple(
"Basic Assertion - assertFalse not false Test",
function<void()>(AssertionsTests::TestAssertFalseNotFalse)
),
make_tuple(
"Basic Assertion - fail Test",
function<void()>(AssertionsTests::TestFail)
)
);
}
}
}

#endif
15 changes: 0 additions & 15 deletions test/include/Assertions/AssertionsTests.h

This file was deleted.

32 changes: 32 additions & 0 deletions test/include/Assertions/BasicAssertionsTests.h
Original file line number Diff line number Diff line change
@@ -0,0 +1,32 @@
#ifndef TESTCPP_ASSERTIONS_TESTS_
#define TESTCPP_ASSERTIONS_TESTS_

namespace TestCPP {
namespace Testing {
namespace AssertionsTests {
void TestAssertEquals ();
void TestAssertEqualsNotEqual ();
void TestAssertEqualsCStrings ();
void TestAssertEqualsCStringsNotEqual ();
void TestAssertNotEquals ();
void TestAssertNotEqualsEqual ();
void TestAssertNotEqualsCStrings ();
void TestAssertNotEqualsCStringsEqual ();
void TestAssertNull ();
void TestAssertNullNotNull ();
void TestAssertNotNull ();
void TestAssertNotNullNull ();
void TestAssertThrows ();
void TestAssertThrowsDoesNotThrow ();
void TestAssertNoThrows ();
void TestAssertNoThrowsThrows ();
void TestAssertTrue ();
void TestAssertTrueNotTrue ();
void TestAssertFalse ();
void TestAssertFalseNotFalse ();
void TestFail ();
}
}
}

#endif
48 changes: 0 additions & 48 deletions test/src/Assertions/AssertionsTests.cpp

This file was deleted.

Loading

0 comments on commit 0c5ba8b

Please sign in to comment.