Clean up interval check function

This commit is contained in:
Soonho Kong 2013-08-16 17:04:14 -07:00
parent 3d8eda2239
commit 93475ac2eb

View file

@ -15,8 +15,8 @@ void check_interval_bop(std::string const & fname, std::string const & varname,
numeric_traits<T1>::set_rounding(true);
f(lu, c);
cout << "\t" << fname << "(" << i.lower() << ", " << c << ") = [" << ll << ", " << lu << "]"<< endl;
lean_assert(r.is_lower_inf() ||
((r.lower() <= ll) && (r.is_upper_inf() || (ll <= r.upper()))));
lean_assert((r.is_lower_inf() || r.lower() <= ll) &&
(r.is_upper_inf() || ll <= r.upper()));
lean_assert(r.is_lower_inf() ||
((r.lower() <= lu) && (r.is_upper_inf() || (lu <= r.upper()))));
}
@ -28,15 +28,16 @@ void check_interval_bop(std::string const & fname, std::string const & varname,
numeric_traits<T1>::set_rounding(true);
f(uu, c);
cout << "\t" << fname << "(" << i.upper() << ", " << c << ") = [" << ul << ", " << uu << "]" << endl;
lean_assert(r.is_upper_inf() ||
((r.is_lower_inf() || (r.lower() <= ul)) && (ul <= r.upper())));
lean_assert(r.is_upper_inf() ||
((r.is_lower_inf() || (r.lower() <= uu)) && (uu <= r.upper())));
lean_assert((r.is_lower_inf() || r.lower() <= ul) &&
(r.is_upper_inf() || ul <= r.upper()));
lean_assert((r.is_lower_inf() || r.lower() <= uu) &&
(r.is_upper_inf() || uu <= r.upper()));
}
}
template <typename T, typename F>
void check_interval_uop(std::string const & fname, std::string const & varname, interval<T> i, interval<T> r, F f) {
cout.precision(30);
cout << fname << "(" << varname << " " << i << ") = ";
cout << r << endl;
if(!i.is_lower_inf()) {
@ -47,8 +48,8 @@ void check_interval_uop(std::string const & fname, std::string const & varname,
numeric_traits<T>::set_rounding(true);
f(lu);
cout << "\t" << fname << "(" << i.lower() << ") = [" << ll << ", " << lu << "]"<< endl;
lean_assert(r.is_lower_inf() ||
((r.lower() <= ll) && (r.is_upper_inf() || (ll <= r.upper()))));
lean_assert((r.is_lower_inf() || r.lower() <= ll) &&
(r.is_upper_inf() || ll <= r.upper()));
lean_assert(r.is_lower_inf() ||
((r.lower() <= lu) && (r.is_upper_inf() || (lu <= r.upper()))));
}
@ -60,10 +61,10 @@ void check_interval_uop(std::string const & fname, std::string const & varname,
numeric_traits<T>::set_rounding(true);
f(uu);
cout << "\t" << fname << "(" << i.upper() << ") = [" << ul << ", " << uu << "]" << endl;
lean_assert(r.is_upper_inf() ||
((r.is_lower_inf() || (r.lower() <= ul)) && (ul <= r.upper())));
lean_assert(r.is_upper_inf() ||
((r.is_lower_inf() || (r.lower() <= uu)) && (uu <= r.upper())));
lean_assert((r.is_lower_inf() || r.lower() <= ul) &&
(r.is_upper_inf() || ul <= r.upper()));
lean_assert((r.is_lower_inf() || r.lower() <= uu) &&
(r.is_upper_inf() || uu <= r.upper()));
}
}