Include debugging printout in patch to example/utility/to_string.cpp.

This commit is contained in:
Brad Bell 2022-01-31 16:49:04 -07:00
commit eb00ce3fab

View file

@ -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 <class Type>
> 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<Integer>::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
# -----------------------------------------------------------------------------