From eb00ce3fab52851536a3c539551ca444769911e1 Mon Sep 17 00:00:00 2001 From: Brad Bell Date: Mon, 31 Jan 2022 16:49:04 -0700 Subject: [PATCH] Include debugging printout in patch to example/utility/to_string.cpp. --- cppad.spec | 33 ++++++++++++++++++++++++++++++++- 1 file changed, 32 insertions(+), 1 deletion(-) diff --git a/cppad.spec b/cppad.spec index c8abdd8..f4059f2 100644 --- a/cppad.spec +++ b/cppad.spec @@ -99,7 +99,20 @@ sed -i.bak CppAD-%{version}/test_more/debug_rel/CMakeLists.txt \ # Patch to fix example/utility/to_string.cpp # This will no longer be necessary once the upstread source > 20220000.1 cat << EOF > to_string.patch -32,36c32,39 +26a27,38 +> template +> void print_error( +> const char* routine_name, +> const char* value_name, +> Type value, +> Type check, +> Type eps = Type(0) ) +> { std::cout << routine_name << " error : "; +> std::cout << value_name << " - check = " << value - check; +> std::cout << ", eps = " << eps << "\n"; +> return; +> } +32,36c44,51 < ++index; < while( index < s.size() ) < result = Integer( 10 * result + (s[index++] - '0') ); @@ -114,6 +127,24 @@ cat << EOF > to_string.patch > { while( index < s.size() ) > result = Integer(10) * result + Integer(s[index++] - '0' ); > } +54a70,71 +> if( max != check ) +> print_error("signed_integer", "max", max, check); +59a77,78 +> if( min != check ) +> print_error("signed_integer", "min", min, check); +70a90,91 +> if( max != check ) +> print_error("unsigned_integer", "max", max, check); +71a93,94 +> if( std::numeric_limits::min() != 0 ) +> std::cout << "unsigned_integer: min != 0\n"; +83a107,108 +> if( ! ok ) +> print_error("floating", "pi", pi, check, eps); +100a126,127 +> if( ! ok ) +> print_error("ad_floating", "pi", pi, check, eps); EOF patch CppAD-%{version}/example/utility/to_string.cpp to_string.patch # -----------------------------------------------------------------------------