List:Commits« Previous MessageNext Message »
From:andrey.hristov Date:November 5 2008 2:39pm
Subject:bzr commit into connector-cpp-bzr branch (andrey.hristov:204)
View as plain text  
#At bzr+ssh://ahristov@stripped/bzrroot/public/connector-cpp-bzr/trunk/

  204 andrey.hristov@stripped	2008-11-05 [merge]
      merge
added:
  test/CJUnitTestsPort/MiniCppUnit/_check_isinf.cpp
modified:
  test/CJUnitTestsPort/CMakeLists.txt
  test/CJUnitTestsPort/MiniCppUnit/MiniCppUnit.cxx
  test/test_common.cpp

=== modified file 'test/CJUnitTestsPort/CMakeLists.txt'
--- a/test/CJUnitTestsPort/CMakeLists.txt	2008-11-04 18:11:30 +0000
+++ b/test/CJUnitTestsPort/CMakeLists.txt	2008-11-05 14:39:32 +0000
@@ -1,3 +1,4 @@
+
 INCLUDE_DIRECTORIES(${MYSQLCPPCONN_SOURCE_DIR})
 INCLUDE_DIRECTORIES(${MYSQLCPPCONN_SOURCE_DIR}/cppconn)
 
@@ -11,6 +12,17 @@ ELSEIF(NOT WIN32)
 	SET(MY_TARGET_LINK_LIBRARIES mysqlcppconn mysqlclient_r)
 ENDIF(WIN32)
 
+TRY_COMPILE(
+	HAVE_ISINF
+	${CMAKE_BINARY_DIR}
+	${CMAKE_SOURCE_DIR}/test/CJUnitTestsPort/MiniCppUnit/_check_isinf.cpp
+	${CMAKE_FLAGS}
+	OUTPUT_VARIABLE OUTPUT
+	)
+IF (HAVE_ISINF)
+	ADD_DEFINITIONS("-DHAVE_ISINF")
+ENDIF(HAVE_ISINF)
+
 SET(jdbctests_sources
 	BaseTestCase.h
 	BaseTestCase.inl

=== modified file 'test/CJUnitTestsPort/MiniCppUnit/MiniCppUnit.cxx'
--- a/test/CJUnitTestsPort/MiniCppUnit/MiniCppUnit.cxx	2008-10-13 12:37:16 +0000
+++ b/test/CJUnitTestsPort/MiniCppUnit/MiniCppUnit.cxx	2008-11-05 12:03:23 +0000
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2003-2004  Pau Arum� David Garc�+ * Copyright (c) 2003-2004  Pau Arum� & David Garc�a
  *
  *
  * This program is free software; you can redistribute it and/or modify
@@ -22,19 +22,27 @@
 
 #include <cmath>
 
-#ifdef _MSC_VER
-#include <float.h>
-namespace std
-{
-  template <typename T>
-  inline bool isnan(T x) { 
-		return _isnan(x) != 0; 
-	}
-	template <typename T>
-	inline bool isinf(T x) { 
-		return _finite(x) == 0; 
-	}
-}
+#ifdef HAVE_ISINF
+	#define my_isinf(X) isinf(X)
+#else
+	#ifdef _MSC_VER
+		#include <float.h>
+		namespace std
+		{
+		template <typename T>
+		inline bool isnan(T x) {
+			return _isnan(x) != 0;
+		}
+		template <typename T>
+		inline bool isinf(T x) {
+			return _finite(x) == 0;
+		}
+		}
+		#define my_isinf(X) isinf(X)
+       #else
+		#include <ieeefp.h>
+		#define my_isinf(X) (!finite(X) && !isnan(X))
+       #endif
 #endif
 
 TestsListener& TestsListener::theInstance()
@@ -232,7 +240,7 @@ bool isNaN(double x)
 double scaledEpsilon(const double& expected, const double& fuzzyEpsilon )
 { 
 	const double aa = fabs(expected)+1;
-	return (std::isinf(aa))? fuzzyEpsilon: fuzzyEpsilon * aa;
+	return (my_isinf(aa))? fuzzyEpsilon: fuzzyEpsilon * aa;
 }
 bool fuzzyEquals(double expected, double result, double fuzzyEpsilon)
 {

=== added file 'test/CJUnitTestsPort/MiniCppUnit/_check_isinf.cpp'
--- a/test/CJUnitTestsPort/MiniCppUnit/_check_isinf.cpp	1970-01-01 00:00:00 +0000
+++ b/test/CJUnitTestsPort/MiniCppUnit/_check_isinf.cpp	2008-11-05 11:46:00 +0000
@@ -0,0 +1,11 @@
+#include <math.h>
+#include <cmath>
+#include <float.h>
+int
+main ()
+{
+	float f = 0.0;
+	int r = isinf(f);
+	return r;
+	return 0;
+}

=== modified file 'test/test_common.cpp'
--- a/test/test_common.cpp	2008-11-03 17:49:01 +0000
+++ b/test/test_common.cpp	2008-11-05 10:45:48 +0000
@@ -49,8 +49,8 @@ static int silent = 1;
 #define USED_DATABASE "test"
 #define DATABASE_TO_USE "USE test"
 
-#define ENTER_FUNCTION()		if (!silent) printf("# >>>>   %s\n# ", __FUNCTION__);
-#define LEAVE_FUNCTION()		if (!silent) printf("# <<<<   %s\n# ", __FUNCTION__); else printf("\n# ");
+#define ENTER_FUNCTION()		if (!silent) printf("# >>>>   %s\n# ", CPPCONN_FUNC);
+#define LEAVE_FUNCTION()		if (!silent) printf("# <<<<   %s\n# ", CPPCONN_FUNC); else printf("\n# ");
 
 #if defined(_WIN32) || defined(_WIN64)
 #pragma warning(disable:4251)

Thread
bzr commit into connector-cpp-bzr branch (andrey.hristov:204) andrey.hristov5 Nov