more portability fixes

This commit is contained in:
Phil Nash 2010-11-12 08:12:01 +00:00
parent 9e4708371e
commit 7e8cfa714f
7 changed files with 13 additions and 8 deletions

View File

@ -10,7 +10,7 @@
* *
*/ */
#include "catch.hpp" #include "../catch.hpp"
namespace namespace
{ {

View File

@ -10,7 +10,7 @@
* *
*/ */
#include "catch.hpp" #include "../catch.hpp"
#include <string> #include <string>

View File

@ -10,7 +10,7 @@
* *
*/ */
#include "catch.hpp" #include "../catch.hpp"
#include <string> #include <string>

View File

@ -10,7 +10,7 @@
* *
*/ */
#include "catch.hpp" #include "../catch.hpp"
TEST_CASE( "succeeding/message", "INFO and WARN do not abort tests" ) TEST_CASE( "succeeding/message", "INFO and WARN do not abort tests" )
{ {

View File

@ -10,7 +10,7 @@
* *
*/ */
#include "catch.hpp" #include "../catch.hpp"
namespace Catch namespace Catch
{ {

View File

@ -10,8 +10,8 @@
* *
*/ */
#include "catch.hpp" #include "../catch.hpp"
#include "catch_runner.hpp" #include "../catch_runner.hpp"
// This code runs the meta tests and verifies that the failing ones failed and the successful ones succeeded // This code runs the meta tests and verifies that the failing ones failed and the successful ones succeeded
int main (int argc, char * const argv[]) int main (int argc, char * const argv[])

View File

@ -218,6 +218,11 @@ private:
#define CATCH_absTol 1e-10 #define CATCH_absTol 1e-10
#define CATCH_relTol 1e-10 #define CATCH_relTol 1e-10
inline double catch_max( double x, double y )
{
return x > y ? x : y;
}
class Approx class Approx
{ {
public: public:
@ -232,7 +237,7 @@ public:
// !TBD Use proper tolerance // !TBD Use proper tolerance
// From: http://realtimecollisiondetection.net/blog/?p=89 // From: http://realtimecollisiondetection.net/blog/?p=89
// see also: http://www.cygnus-software.com/papers/comparingfloats/comparingfloats.htm // see also: http://www.cygnus-software.com/papers/comparingfloats/comparingfloats.htm
return fabs( lhs - rhs.m_d ) <= std::max( CATCH_absTol, CATCH_relTol * std::max( fabs(lhs), fabs(rhs.m_d) ) ); return fabs( lhs - rhs.m_d ) <= catch_max( CATCH_absTol, CATCH_relTol * catch_max( fabs(lhs), fabs(rhs.m_d) ) );
} }
template<typename T> template<typename T>