Skip to content

Commit

Permalink
Merge pull request cpputest#647 from arstrube/divbyzero
Browse files Browse the repository at this point in the history
Remove division-by-zero tests again because
  • Loading branch information
basvodde committed May 10, 2015
2 parents a9c8a7a + 5ae714c commit 8400f4a
Show file tree
Hide file tree
Showing 4 changed files with 0 additions and 26 deletions.
1 change: 0 additions & 1 deletion include/CppUTest/Utest.h
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,6 @@ class TestFilter;
class TestTerminator;

extern bool doubles_equal(double d1, double d2, double threshold);
extern int division(int one, int two);

//////////////////// Utest

Expand Down
5 changes: 0 additions & 5 deletions src/CppUTest/Utest.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -37,11 +37,6 @@ bool doubles_equal(double d1, double d2, double threshold)
return PlatformSpecificFabs(d1 - d2) <= threshold;
}

int division(int one, int two)
{
return one / two;
}

/* Sometimes stubs use the CppUTest assertions.
* Its not correct to do so, but this small helper class will prevent a segmentation fault and instead
* will give an error message and also the file/line of the check that was executed outside the tests.
Expand Down
15 changes: 0 additions & 15 deletions tests/UtestPlatformTest.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -94,13 +94,6 @@ static int _accessViolationTestFunction()
return *(volatile int*) 0;
}

static int _divisionByZeroTestFunction()
{
int divisionByZero = division(1, 0);
FAIL(StringFromFormat("Should have divided by zero. Outcome: %d", divisionByZero).asCharString());
return divisionByZero;
}

#include <unistd.h>
#include <signal.h>

Expand All @@ -125,14 +118,6 @@ TEST(UTestPlatformsTest_PlatformSpecificRunTestInASeperateProcess, AccessViolati
fixture.assertPrintContains("Failed in separate process - killed by signal 11");
}

TEST(UTestPlatformsTest_PlatformSpecificRunTestInASeperateProcess, DivisionByZeroInSeparateProcessWorks)
{
fixture.registry_->setRunTestsInSeperateProcess();
fixture.setTestFunction((void(*)())_divisionByZeroTestFunction);
fixture.runAllTests();
fixture.assertPrintContains("Failed in separate process - killed by signal 8");
}

TEST(UTestPlatformsTest_PlatformSpecificRunTestInASeperateProcess, StoppedInSeparateProcessWorks)
{
fixture.registry_->setRunTestsInSeperateProcess();
Expand Down
5 changes: 0 additions & 5 deletions tests/UtestTest.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -34,11 +34,6 @@ TEST_GROUP(Utest)
{
};

TEST(Utest, division)
{
LONGS_EQUAL(3, division(13, 4));
}

TEST_GROUP(UtestShell)
{
TestTestingFixture fixture;
Expand Down

0 comments on commit 8400f4a

Please sign in to comment.