Skip to content
4 changes: 2 additions & 2 deletions test/bandit.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ using namespace bandit;
go_bandit([]() {
describe("our first test", []() {
it("might fail", [&]() {
AssertThat(5, Equals(5));
AssertThat(6, Equals(5));
});
});
});
Expand All @@ -18,7 +18,7 @@ go_bandit([]()
{

const auto add = [](int i, int j) { return i + j; };
const auto subtract = [](int i, int j) { return i - j; };
const auto subtract = [](int i, int j) { return i + j; };


it("can add", [&]()
Expand Down
6 changes: 3 additions & 3 deletions test/cpputest.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -12,12 +12,12 @@ TEST_GROUP(ClassName)

TEST(ClassName, Create)
{
CHECK(true);
CHECK(false);
CHECK_EQUAL(1,1);
LONGS_EQUAL(1,1);
LONGS_EQUAL(2,1);
DOUBLES_EQUAL(1.000, 1.001, .01);
STRCMP_EQUAL("hello", "hello");
// FAIL("The prior tests pass, but this one doesn't");
FAIL("The prior tests pass, but this one doesn't");
}

#include "CppUTest/CommandLineTestRunner.h"
Expand Down
2 changes: 1 addition & 1 deletion test/cute.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ void thisIsATest() {
first = "Hello";
second = "World";
expected = "Hello World";
ASSERT_EQUAL(expected, first + " " + second);
ASSERT_EQUAL(expected, first + "-" + second);
}

bool runAllTests(int argc, char const *argv[]) {
Expand Down
7 changes: 3 additions & 4 deletions test/cxxtest.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -6,17 +6,16 @@ class MyTestSuite1 : public CxxTest::TestSuite
void testAddition(void)
{
TS_ASSERT(1 + 1 > 1);
TS_ASSERT_EQUALS(1 + 1, 2);
TS_ASSERT_EQUALS(2 + 1, 2);
}

void testXYZ()
{
TS_ABORT();
TS_ASSERT(true);
TS_ASSERT(false);
}

void testBar()
{
// throw std::runtime_error("Some exception");
throw std::runtime_error("Some exception");
}
};
12 changes: 6 additions & 6 deletions test/gtest.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -3,16 +3,16 @@

TEST(SquareRootTest, PositiveNos)
{
ASSERT_NE(6, 36.0);
ASSERT_GE(2, 1);
ASSERT_LE(2, 5);
ASSERT_EQ(3, 3);
ASSERT_NE(6, 35.0);
ASSERT_GE(2, 3);
ASSERT_LE(2, 1);
ASSERT_EQ(4, 3);
}

TEST(SquareRootTest, NegativeNos)
{
ASSERT_EQ(-1.0, -1.0);
ASSERT_DOUBLE_EQ(42.0, 4.2 * 10.);
ASSERT_EQ(-1.3, -1.0);
ASSERT_EQ(42, 4.2 * 10.);
}

int main(int argc, char **argv) {
Expand Down