vector: use TAP in tests

This commit is contained in:
Danny Robson 2015-07-21 02:55:11 +10:00
parent 8c3dc295cf
commit 7396057508

View File

@ -8,7 +8,7 @@ using util::vector2f;
void
test_polar (void)
test_polar (util::TAP::logger &tap)
{
static const struct {
util::vector2f polar;
@ -47,7 +47,7 @@ test_polar (void)
auto in_cart = t.cartesian;
auto to_cart = util::polar_to_cartesian (t.polar);
CHECK_LT ((in_cart - to_cart).magnitude (), 0.00001f);
tap.expect_lt ((in_cart - to_cart).magnitude (), 0.00001f, t.desc);
// Compare polar representations. Make sure to normalise them first.
auto in_polar = t.polar;
@ -56,7 +56,7 @@ test_polar (void)
in_polar[1] = std::fmod (in_polar[1], 2 * PI<float>);
to_polar[1] = std::fmod (to_polar[1], 2 * PI<float>);
CHECK_EQ (in_polar, to_polar);
tap.expect_eq (in_polar, to_polar, t.desc);
}
}
@ -64,13 +64,12 @@ test_polar (void)
int
main ()
{
util::TAP::logger test;
util::TAP::logger tap;
test.skip ("convert to TAP");
test_polar ();
test_polar (tap);
test.expect (!util::vector3f::ZERO.is_normalised (), "zero isn't normalised");
test.expect (!util::vector3f::UNIT.is_normalised (), "unit is normalised");
tap.expect (!util::vector3f::ZERO.is_normalised (), "zero isn't normalised");
tap.expect (!util::vector3f::UNIT.is_normalised (), "unit is normalised");
return test.status ();
return tap.status ();
}