Skip to content

Commit

Permalink
Merge pull request #1068 from felipe-lavratti/macos_ieee_fix_squashed
Browse files Browse the repository at this point in the history
Removing IEEE754 implementation from Mac OSx
  • Loading branch information
basvodde committed Dec 8, 2016
2 parents 7e9ff45 + fa783f7 commit 4949236
Show file tree
Hide file tree
Showing 4 changed files with 54 additions and 2 deletions.
2 changes: 1 addition & 1 deletion examples/AllTests/FEDemoTest.cpp
Expand Up @@ -28,9 +28,9 @@
#include "CppUTest/CommandLineTestRunner.h"
#include "CppUTest/TestHarness.h"
#include "CppUTest/TestRegistry.h"
#include "CppUTestExt/IEEE754ExceptionsPlugin.h"

#ifdef CPPUTEST_HAVE_FENV
#include "CppUTestExt/IEEE754ExceptionsPlugin.h"

/*
* To see a demonstration of tests failing as a result of IEEE754ExceptionsPlugin
Expand Down
2 changes: 1 addition & 1 deletion include/CppUTest/CppUTestConfig.h
Expand Up @@ -172,7 +172,7 @@
* Works on non-Visual C++ compilers and Visual C++ 2008 and newer
*/

#if CPPUTEST_USE_STD_C_LIB && (!defined(_MSC_VER) || (_MSC_VER >= 1800))
#if CPPUTEST_USE_STD_C_LIB && (!defined(_MSC_VER) || (_MSC_VER >= 1800)) && (!defined(__APPLE__))
#define CPPUTEST_HAVE_FENV
#if defined(__WATCOMC__) || defined(__ARMEL__) || defined(__m68k__)
#define CPPUTEST_FENV_IS_WORKING_PROPERLY 0
Expand Down
50 changes: 50 additions & 0 deletions src/CppUTestExt/IEEE754ExceptionsPlugin.cpp
Expand Up @@ -100,4 +100,54 @@ void IEEE754ExceptionsPlugin::ieee754Check(UtestShell& test, TestResult& result,
}
}

#else


bool IEEE754ExceptionsPlugin::inexactDisabled_ = true;

IEEE754ExceptionsPlugin::IEEE754ExceptionsPlugin(const SimpleString& name)
: TestPlugin(name)
{
}

void IEEE754ExceptionsPlugin::preTestAction(UtestShell&, TestResult&)
{
}

void IEEE754ExceptionsPlugin::postTestAction(UtestShell&, TestResult&)
{
}

void IEEE754ExceptionsPlugin::disableInexact()
{
}

void IEEE754ExceptionsPlugin::enableInexact()
{
}

bool IEEE754ExceptionsPlugin::checkIeee754OverflowExceptionFlag()
{
return false;
}

bool IEEE754ExceptionsPlugin::checkIeee754UnderflowExceptionFlag()
{
return false;
}

bool IEEE754ExceptionsPlugin::checkIeee754InexactExceptionFlag()
{
return false;
}

bool IEEE754ExceptionsPlugin::checkIeee754DivByZeroExceptionFlag()
{
return false;
}

void IEEE754ExceptionsPlugin::ieee754Check(UtestShell&, TestResult&, int, const char*)
{
}

#endif
2 changes: 2 additions & 0 deletions tests/CppUTestExt/IEEE754PluginTest.cpp
Expand Up @@ -31,6 +31,7 @@
#include "CppUTest/TestTestingFixture.h"
#include "CppUTestExt/IEEE754ExceptionsPlugin.h"

#ifdef CPPUTEST_HAVE_FENV
#if CPPUTEST_FENV_IS_WORKING_PROPERLY

extern "C"
Expand Down Expand Up @@ -143,3 +144,4 @@ IGNORE_TEST(IEEE754ExceptionsPlugin2, should_not_fail_in_ignored_test)
}

#endif
#endif

0 comments on commit 4949236

Please sign in to comment.