lmi-commits
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[lmi-commits] (no subject)


From: Greg Chicares
Subject: [lmi-commits] (no subject)
Date: Tue, 7 Jun 2016 19:23:59 +0000 (UTC)

branch: master
commit 03764469eabe44b584e61770e1c74d353734c8d9
Author: Gregory W. Chicares <address@hidden>
Date:   Tue Jun 7 19:20:33 2016 +0000

    Remove borland workarounds from unit tests
    
    This intrusive clutter made the code difficult to read, and addressed
    real compiler deficiencies rather than mere differences.
---
 any_member_test.cpp            |    8 --------
 contains_test.cpp              |    8 --------
 expression_template_0_test.cpp |   12 ++----------
 fenv_lmi_test.cpp              |    4 +---
 financial_test.cpp             |    6 +-----
 miscellany_test.cpp            |    2 --
 name_value_pairs_test.cpp      |    8 ++------
 ncnnnpnn_test.cpp              |   10 ----------
 numeric_io_test.cpp            |    6 +-----
 obstruct_slicing_test.cpp      |    8 +-------
 timer_test.cpp                 |    6 +-----
 tn_range_test.cpp              |    4 ----
 value_cast_test.cpp            |   23 +----------------------
 13 files changed, 10 insertions(+), 95 deletions(-)

diff --git a/any_member_test.cpp b/any_member_test.cpp
index 72b7ecf..f3e9611 100644
--- a/any_member_test.cpp
+++ b/any_member_test.cpp
@@ -363,11 +363,7 @@ void any_member_test::test_any_member()
     s.d0 = std::exp(1.0);
     double d1 = *s["d0"].exact_cast<double>();
     BOOST_TEST_EQUAL(numeric_io_cast<std::string>(d1), "2.718281828459045");
-#if !defined __BORLANDC__
-    // This test fails with (defective) borland tools, which cannot
-    // handle the numeric-conversion routines correctly.
     BOOST_TEST_EQUAL(s["d0"].str(), "2.718281828459045");
-#endif // !defined __BORLANDC__
 
 // COMPILER !! The borland compiler can build the program with the
 // following line, but a run-time exception results.
@@ -471,7 +467,6 @@ void any_member_test::supplemental_test0()
 //    base_datum const* bp2 = member_cast<base_datum>(s["dd"]);
 //    BOOST_TEST_EQUAL(1729, bp2->virtual_function());
 
-#if !defined __BORLANDC__
     // COMPILER !! The borland compiler doesn't find the const overload;
     // presumably it is defective in this respect.
     S const& r = s;
@@ -479,7 +474,6 @@ void any_member_test::supplemental_test0()
     BOOST_TEST_EQUAL(7, bp3->sane);
     // This is appropriately forbidden: virtual_function() is not const.
 //    BOOST_TEST_EQUAL(1729, bp3->virtual_function());
-#endif // !defined __BORLANDC__
 
     // If the original type is known, an explicit exact_cast is possible.
     BOOST_TEST_EQUAL(1729, 
s["dd"].exact_cast<derived_datum>()->virtual_function());
@@ -630,12 +624,10 @@ void any_member_test::supplemental_test1()
 
     BOOST_TEST_THROW(r2["unknown_member"], std::runtime_error, "");
 
-#if !defined __BORLANDC__
     // Assigning a decimal-literal value to an integer isn't type
     // safe, and might require truncation, so it's forbidden.
     BOOST_TEST_THROW(r2["i0"] = "888e3", std::invalid_argument, "");
     BOOST_TEST_THROW(r2["i1"] = "999.9", std::invalid_argument, "");
-#endif // !defined __BORLANDC__
 }
 
 // This test detects a problem with the original distribution of
diff --git a/contains_test.cpp b/contains_test.cpp
index 3a25710..ded8ed8 100644
--- a/contains_test.cpp
+++ b/contains_test.cpp
@@ -79,19 +79,11 @@ void test_contains()
 
     // Associative containers.
 
-#if !defined __BORLANDC__
     std::map<std::string,std::string> const m(z, z + lmi_array_size(z));
-#else  // defined __BORLANDC__
-    std::map<std::string,std::string> const m(z, z + 2);
-#endif // defined __BORLANDC__
     BOOST_TEST( contains(m, "uatis inem"    ));
     BOOST_TEST(!contains(m, "cows and ducks"));
 
-#if !defined __BORLANDC__
     std::set<std::string> const s(y, y + lmi_array_size(y));
-#else  // defined __BORLANDC__
-    std::set<std::string> const s(y, y + 4);
-#endif // defined __BORLANDC__
     BOOST_TEST( contains(s, "si ergo" ));
     BOOST_TEST(!contains(s, "fortibus"));
 
diff --git a/expression_template_0_test.cpp b/expression_template_0_test.cpp
index 799931d..d81fd2a 100644
--- a/expression_template_0_test.cpp
+++ b/expression_template_0_test.cpp
@@ -21,9 +21,7 @@
 
 #include "pchfile.hpp"
 
-#if !defined __BORLANDC__
-#   define USE_UBLAS
-#endif // !defined __BORLANDC__
+#define USE_UBLAS
 
 #if defined USE_UBLAS
 // BOOST !! Startlingly enough, boost uBLAS depends on this standard
@@ -44,9 +42,7 @@
 #include "test_tools.hpp"
 #include "timer.hpp"
 
-#if !defined __BORLANDC__
-#   include <boost/bind.hpp>
-#endif // !defined __BORLANDC__
+#include <boost/bind.hpp>
 
 #if defined USE_UBLAS
 #   include <boost/numeric/ublas/vector.hpp>
@@ -204,7 +200,6 @@ void mete_stl_plain()
 
 void mete_stl_fancy()
 {
-#if !defined __BORLANDC__
     static std::vector<double> tmp0(max_length);
     std::transform
         (sv0b.begin()
@@ -228,7 +223,6 @@ void mete_stl_fancy()
         ,sv2b.begin()
         ,std::plus<double>()
         );
-#endif // !defined __BORLANDC__
 }
 
 /// This implementation uses std::valarray.
@@ -418,11 +412,9 @@ void time_one_array_length(int length)
     BOOST_TEST_EQUAL           (sv2a[alpha], value_alpha);
     BOOST_TEST(materially_equal(sv2a[omega], value_omega));
 
-#if !defined __BORLANDC__
     mete_stl_fancy();
     BOOST_TEST_EQUAL           (sv2b[alpha], value_alpha);
     BOOST_TEST(materially_equal(sv2b[omega], value_omega));
-#endif // !defined __BORLANDC__
 
     mete_valarray();
     BOOST_TEST_EQUAL           (va2 [alpha], value_alpha);
diff --git a/fenv_lmi_test.cpp b/fenv_lmi_test.cpp
index b5ad944..bc4e43a 100644
--- a/fenv_lmi_test.cpp
+++ b/fenv_lmi_test.cpp
@@ -67,9 +67,7 @@ std::bitset<CHAR_BIT * sizeof(unsigned long int)> 
bits(unsigned long int i)
 
 int test_main(int, char*[])
 {
-#if defined __BORLANDC__
-    // Skip many tests that this defective compiler can't handle.
-#elif defined LMI_X86
+#if defined LMI_X86
     unsigned short int cw = 0x0000;
 
     BOOST_TEST_EQUAL_BITS(0x037f, msw_to_intel(0x0008001f));
diff --git a/financial_test.cpp b/financial_test.cpp
index 2dca1b1..39aa538 100644
--- a/financial_test.cpp
+++ b/financial_test.cpp
@@ -26,9 +26,7 @@
 #include "test_tools.hpp"
 #include "timer.hpp"
 
-#if !defined __BORLANDC__
-#   include <boost/bind.hpp>
-#endif // !defined __BORLANDC__
+#include <boost/bind.hpp>
 
 #include <cmath>                        // std::fabs()
 #include <iomanip>                      // Formatting of optional detail.
@@ -174,7 +172,6 @@ std::cout << "tolerance = .000005: " << .000005 << '\n';
         <= tolerance
         );
 
-#if !defined __BORLANDC__
     typedef std::vector<double>::iterator VI;
     int const decimals = 5;
     std::cout
@@ -195,7 +192,6 @@ std::cout << "tolerance = .000005: " << .000005 << '\n';
             )
         << '\n'
         ;
-#endif // !defined __BORLANDC__
 
     return 0;
 }
diff --git a/miscellany_test.cpp b/miscellany_test.cpp
index 6755861..7c405e4 100644
--- a/miscellany_test.cpp
+++ b/miscellany_test.cpp
@@ -88,10 +88,8 @@ void test_minmax()
     // Motivation for relational operators: to write this...
     BOOST_TEST(zero <= m.minimum() && m.maximum() <= one);
     // ...more compactly:
-#if !defined __BORLANDC__
     BOOST_TEST(  zero <= m && m <= one );
     BOOST_TEST(!(zero <  m || m <  one));
-#endif // !defined __BORLANDC__
 }
 
 void test_prefix_and_suffix()
diff --git a/name_value_pairs_test.cpp b/name_value_pairs_test.cpp
index 0db663f..c306008 100644
--- a/name_value_pairs_test.cpp
+++ b/name_value_pairs_test.cpp
@@ -26,20 +26,16 @@
 #include "miscellany.hpp"
 #include "test_tools.hpp"
 
-#if !defined __BORLANDC__
-#   include <boost/filesystem/operations.hpp>
-#   include <boost/filesystem/path.hpp>
-#endif // !defined __BORLANDC__
+#include <boost/filesystem/operations.hpp>
+#include <boost/filesystem/path.hpp>
 
 #include <cstdio>                       // std::remove()
 #include <fstream>
 
 int test_main(int, char*[])
 {
-#if !defined __BORLANDC__
     fs::path const tmpdir(fs::complete("/tmp"));
     fs::create_directory(tmpdir);
-#endif // !defined __BORLANDC__
 
     std::string filename0("/tmp/eraseme");
 
diff --git a/ncnnnpnn_test.cpp b/ncnnnpnn_test.cpp
index 2fc67b9..2f481ae 100644
--- a/ncnnnpnn_test.cpp
+++ b/ncnnnpnn_test.cpp
@@ -137,20 +137,10 @@ int test_main(int, char*[])
     ncnnnpnn( 1.0 / d  );
     ncnnnpnn(-1.0 / d  );
 
-#if !defined __BORLANDC__
     if(std::numeric_limits<long double>::has_quiet_NaN)
         {
         ncnnnpnn(std::numeric_limits<long double>::quiet_NaN());
         }
-#else // defined __BORLANDC__
-    // COMPILER !! Problem with borland compiler: see
-    //   http://lists.boost.org/Archives/boost/2001/05/12046.php
-    //   http://lists.boost.org/Archives/boost/2001/05/12078.php
-    // We choose to avoid the hardware exception here,
-    // so that all our tests can run to completion
-    // unattended; but it is a failure, so:
-    BOOST_TEST(false);
-#endif // defined __BORLANDC__
 
     return 0;
 }
diff --git a/numeric_io_test.cpp b/numeric_io_test.cpp
index 11704e5..264fb92 100644
--- a/numeric_io_test.cpp
+++ b/numeric_io_test.cpp
@@ -29,9 +29,7 @@
 #include "test_tools.hpp"
 #include "timer.hpp"
 
-#if !defined __BORLANDC__
-#   include <boost/lexical_cast.hpp>
-#endif // ! defined __BORLANDC__
+#include <boost/lexical_cast.hpp>
 
 #include <cmath>                        // std::exp()
 #include <limits>
@@ -84,11 +82,9 @@ void mete_two_thirds()
 
 void mete_two_thirds_boost()
 {
-#if !defined __BORLANDC__
     std::string s = boost::lexical_cast<std::string>(2.0 / 3.0);
     double d = boost::lexical_cast<double>(s);
     stifle_warning_for_unused_value(d);
-#endif // ! defined __BORLANDC__
 }
 
 void mete_infinity()
diff --git a/obstruct_slicing_test.cpp b/obstruct_slicing_test.cpp
index 9f4567b..6846dd0 100644
--- a/obstruct_slicing_test.cpp
+++ b/obstruct_slicing_test.cpp
@@ -26,9 +26,7 @@
 #include "test_tools.hpp"
 #include "timer.hpp"
 
-#if !defined __BORLANDC__
-#   include <boost/bind.hpp>
-#endif // !defined __BORLANDC__
+#include <boost/bind.hpp>
 
 #include <string>
 
@@ -141,14 +139,12 @@ void mete(volatile int vi)
 template<typename T>
 void test_cost_of_obstruction(std::string const& s)
 {
-#if !defined __BORLANDC__
     std::cout
         << "  Class " << s << " has size " << sizeof(T) << '\n'
         << "  Speed test: \n      "
         << TimeAnAliquot(boost::bind(mete<T>, 0))
         << '\n'
         ;
-#endif // !defined __BORLANDC__
 }
 
 int test_main(int, char*[])
@@ -158,10 +154,8 @@ int test_main(int, char*[])
     // Correctness is verifiable only at compile time. At run time,
     // there's nothing to test except the cost.
 
-#if !defined __BORLANDC__
     test_cost_of_obstruction<X0>("X0");
     test_cost_of_obstruction<X1>("X1");
-#endif // !defined __BORLANDC__
 
     return EXIT_SUCCESS;
 }
diff --git a/timer_test.cpp b/timer_test.cpp
index 675179d..cd445f6 100644
--- a/timer_test.cpp
+++ b/timer_test.cpp
@@ -27,9 +27,7 @@
 #include "miscellany.hpp"
 #include "test_tools.hpp"
 
-#if !defined __BORLANDC__
-#   include <boost/bind.hpp>
-#endif // !defined __BORLANDC__
+#include <boost/bind.hpp>
 
 #include <cmath>
 
@@ -115,10 +113,8 @@ void TimerTest::TestAliquotTimer()
 
     std::cout << "  " << TimeAnAliquot(foo, 0.1) << '\n';
 
-#if !defined __BORLANDC__
     X x;
     std::cout << "  " << TimeAnAliquot(boost::bind(goo, 10, x, x, &x), 0.1) << 
'\n';
-#endif // !defined __BORLANDC__
 
     std::string takes_too_long = TimeAnAliquot(WaitTenMsec, 0.0099999).str();
     BOOST_TEST(contains(takes_too_long, "took longer"));
diff --git a/tn_range_test.cpp b/tn_range_test.cpp
index f314b5d..36cec09 100644
--- a/tn_range_test.cpp
+++ b/tn_range_test.cpp
@@ -164,9 +164,6 @@ void tn_range_test::test_auxiliary_functions(char const* 
file, int line)
         INVOKE_BOOST_TEST_EQUAL( 1, signum( infT), file, line);
         }
 
-#if !defined __BORLANDC__
-    // COMPILER !! The borland compiler tends to crash msw xp whenever
-    // a quiet NaN is used.
     bool volatile has_quiet_NaN = std::numeric_limits<T>::has_quiet_NaN;
     if(is_iec559 && has_quiet_NaN)
         {
@@ -174,7 +171,6 @@ void tn_range_test::test_auxiliary_functions(char const* 
file, int line)
         INVOKE_BOOST_TEST_EQUAL( 0, signum(-qnanT), file, line);
         INVOKE_BOOST_TEST_EQUAL( 0, signum( qnanT), file, line);
         }
-#endif // Not borland compiler.
 }
 
 template<typename T>
diff --git a/value_cast_test.cpp b/value_cast_test.cpp
index 190af45..3b615ed 100644
--- a/value_cast_test.cpp
+++ b/value_cast_test.cpp
@@ -26,9 +26,7 @@
 #include "miscellany.hpp"
 #include "test_tools.hpp"
 
-#if !defined __BORLANDC__
-#   include <boost/lexical_cast.hpp>
-#endif // !defined __BORLANDC__
+#include <boost/lexical_cast.hpp>
 
 #include <cmath>                        // std::pow()
 #include <cstring>                      // std::strcpy(), std::strcmp
@@ -46,13 +44,11 @@ struct X {std::string s;};
 std::istream& operator>>(std::istream& is, X&       x) {is >> x.s; return is;}
 std::ostream& operator<<(std::ostream& os, X const& x) {os << x.s; return os;}
 
-#if !defined __BORLANDC__
 template<typename To, typename From>
 cast_method method(From, To)
 {
     return value_cast_chooser<To,From>::method();
 }
-#endif // !defined __BORLANDC__
 
 int extra_tests0();
 int extra_tests1();
@@ -63,7 +59,6 @@ int test_main(int, char*[])
     // These could be static assertions, but any failure would prevent
     // other tests from running.
 
-#if !defined __BORLANDC__
     BOOST_TEST( is_string<char               *>::value);
     BOOST_TEST( is_string<char const         *>::value);
     BOOST_TEST(!is_string<char       volatile*>::value);
@@ -73,7 +68,6 @@ int test_main(int, char*[])
     BOOST_TEST(is_string<std::string      &>::value);
     BOOST_TEST(is_string<std::string const >::value);
     BOOST_TEST(is_string<std::string const&>::value);
-#endif // !defined __BORLANDC__
 
 // These tests fail to compile:
 //    BOOST_TEST(is_string<std::string volatile>::value);
@@ -87,7 +81,6 @@ int test_main(int, char*[])
     X x;
     NotDefaultConstructible n_d_c(std::cin);
 
-#if !defined __BORLANDC__
     // Test which conversion is used for type double.
 
     BOOST_TEST_EQUAL(e_both_numeric ,method(d   ,d  ));
@@ -131,9 +124,6 @@ int test_main(int, char*[])
 
     n_d_c = value_cast<NotDefaultConstructible>(n_d_c);
     n_d_c = value_cast(n_d_c, n_d_c);
-#else  // defined __BORLANDC__
-    stifle_warning_for_unused_variable(cp);
-#endif // defined __BORLANDC__
 
     // Forbidden conversions to pointer, detected at compile time.
 //    cp = value_cast(d, cp);
@@ -158,7 +148,6 @@ int test_main(int, char*[])
     // numeric_cast delegates to boost::numeric::converter:
     i = boost::numeric_cast<int>(2.71828);
     // but these do:
-#if !defined __BORLANDC__
     BOOST_TEST_THROW
         (i = value_cast<int>(d)
         ,std::runtime_error
@@ -169,7 +158,6 @@ int test_main(int, char*[])
         ,std::runtime_error
         ,"Value not preserved converting 2.71828 to 2 ."
         );
-#endif // !defined __BORLANDC__
 
     // This conversion should work: value is exactly preserved.
 
@@ -277,7 +265,6 @@ int extra_tests0()
     a = value_cast<std::string>(d);
     BOOST_TEST_EQUAL("3.14159", a);
 
-#if !defined __BORLANDC__
     BOOST_TEST_THROW(value_cast<double>(b) , std::invalid_argument, "");
     BOOST_TEST_THROW(value_cast<double>(""), std::invalid_argument, "");
 
@@ -306,7 +293,6 @@ int extra_tests0()
         ,std::runtime_error
         ,"Cannot convert (char const*)(0) to number."
         );
-#endif // !defined __BORLANDC__
 
     d = value_cast<double>(a);
     BOOST_TEST_EQUAL(3.14159, d);
@@ -477,7 +463,6 @@ int extra_tests1()
 ///
 /// TODO ?? Many of the boost tests remain to be adapted.
 
-#if !defined __BORLANDC__
 int boost_tests()
 {
     // Original boost::lexical_cast test suite, with wchar_t tests
@@ -798,10 +783,4 @@ int boost_tests()
 
     return 0;
 }
-#else  // defined __BORLANDC__
-int boost_tests()
-{
-    return 0;
-}
-#endif // defined __BORLANDC__
 



reply via email to

[Prev in Thread] Current Thread [Next in Thread]