#include "fixed.hpp" #include "types/string.hpp" #include "tap.hpp" template void test_simple (util::TAP::logger &tap) { using fixed_t = util::fixed; using integer_t = typename fixed_t::integer_t; const fixed_t lo {integer_t{0}}; const fixed_t hi {integer_t{1}}; std::ostringstream os; os << "fixed<" << type_to_string () << ',' << I << ',' << E << '>'; tap.expect_eq (lo, lo, "%s self equality", os.str ()); tap.expect_eq (hi, hi, "%s self equality", os.str ()); tap.expect_neq (hi, lo, "%s inequality", os.str ()); tap.expect_neq (lo, hi, "%s inequality", os.str ()); tap.expect_lt (lo, hi, "%s less than", os.str ()); tap.expect_le (lo, hi, "%s less than equal", os.str ()); tap.expect_le (lo, lo, "%s less than equal", os.str ()); tap.expect_gt (hi, lo, "%s greater than", os.str ()); tap.expect_ge (lo, lo, "%s greater than equal", os.str ()); tap.expect_ge (hi, lo, "%s greater than equal", os.str ()); } int main (void) { util::TAP::logger tap; test_simple (tap); test_simple (tap); test_simple (tap); test_simple (tap); test_simple (tap); test_simple (tap); }