qpid-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From acon...@apache.org
Subject svn commit: r1678246 - /qpid/trunk/qpid/cpp/src/tests/FieldValue.cpp
Date Thu, 07 May 2015 18:07:03 GMT
Author: aconway
Date: Thu May  7 18:07:02 2015
New Revision: 1678246

URL: http://svn.apache.org/r1678246
Log:
NO-JIRA: Fix floating point FieldValue tests to work on older compilers/boost versions.

This fixes compile errors seen on gcc-c++-4.1.2-55.el5, boost-devel-1.33.1-16.el5_9
Float/double conversion and template matching issues.
Probably down to  boost, but might be gcc related.

Modified:
    qpid/trunk/qpid/cpp/src/tests/FieldValue.cpp

Modified: qpid/trunk/qpid/cpp/src/tests/FieldValue.cpp
URL: http://svn.apache.org/viewvc/qpid/trunk/qpid/cpp/src/tests/FieldValue.cpp?rev=1678246&r1=1678245&r2=1678246&view=diff
==============================================================================
--- qpid/trunk/qpid/cpp/src/tests/FieldValue.cpp (original)
+++ qpid/trunk/qpid/cpp/src/tests/FieldValue.cpp Thu May  7 18:07:02 2015
@@ -62,11 +62,11 @@ QPID_AUTO_TEST_CASE(testIntegerValueEqua
 QPID_AUTO_TEST_CASE(testFloatValueEquals)
 {
     BOOST_CHECK(f.convertsTo<float>() == true);
-    BOOST_CHECK_EQUAL(FloatValue(42.42), f);
-    BOOST_CHECK_CLOSE(f.get<float>(), 42.42, 0.001);
+    BOOST_CHECK(FloatValue(42.42) == f);
+    BOOST_CHECK_CLOSE(double(f.get<float>()), 42.42, 0.001);
     // Check twice, regression test for QPID-6470 where the value was corrupted during get.
-    BOOST_CHECK_EQUAL(FloatValue(42.42), f);
-    BOOST_CHECK_CLOSE(f.get<float>(), 42.42, 0.001);
+    BOOST_CHECK(FloatValue(42.42) == f);
+    BOOST_CHECK_CLOSE(f.get<double>(), 42.42, 0.001);
 
     // Float to double conversion
     BOOST_CHECK(f.convertsTo<double>() == true);
@@ -75,7 +75,7 @@ QPID_AUTO_TEST_CASE(testFloatValueEquals
     // Double value
     BOOST_CHECK(f.convertsTo<float>() == true);
     BOOST_CHECK(f.convertsTo<double>() == true);
-    BOOST_CHECK_CLOSE(df.get<float>(), 123.123, 0.001);
+    BOOST_CHECK_CLOSE(double(df.get<float>()), 123.123, 0.001);
     BOOST_CHECK_CLOSE(df.get<double>(), 123.123, 0.001);
 
     // Invalid conversions should fail.
@@ -85,12 +85,12 @@ QPID_AUTO_TEST_CASE(testFloatValueEquals
     BOOST_CHECK_THROW(f.get<int>(), InvalidConversionException);
 
     // getFloatingPointValue: check twice, regression test for QPID-6470
-    BOOST_CHECK_CLOSE((f.getFloatingPointValue<float,sizeof(float)>()), 42.42, 0.001);
-    BOOST_CHECK_CLOSE((f.getFloatingPointValue<float,sizeof(float)>()), 42.42, 0.001);
+    BOOST_CHECK_CLOSE((double(f.getFloatingPointValue<float,sizeof(float)>())), 42.42,
0.001);
+    BOOST_CHECK_CLOSE((double(f.getFloatingPointValue<float,sizeof(float)>())), 42.42,
0.001);
     BOOST_CHECK_CLOSE((df.getFloatingPointValue<double,sizeof(double)>()), 123.123,
0.001);
     // getFloatingPointValue should *not* convert float/double, require exact type.
     BOOST_CHECK_THROW((f.getFloatingPointValue<double,sizeof(double)>()), InvalidConversionException);
-    BOOST_CHECK_THROW((df.getFloatingPointValue<float,sizeof(float)>()), InvalidConversionException);
+    BOOST_CHECK_THROW((double(df.getFloatingPointValue<float,sizeof(float)>())), InvalidConversionException);
 }
 
 QPID_AUTO_TEST_SUITE_END()



---------------------------------------------------------------------
To unsubscribe, e-mail: commits-unsubscribe@qpid.apache.org
For additional commands, e-mail: commits-help@qpid.apache.org


Mime
View raw message