coord: add trivial operation tests

This commit is contained in:
Danny Robson 2016-03-14 22:32:52 +11:00
parent df08e33552
commit 9e9477858b

View File

@ -1,6 +1,8 @@
#include "tap.hpp" #include "tap.hpp"
#include "point.hpp" #include "point.hpp"
#include "coord/iostream.hpp"
int int
main (void) main (void)
{ {
@ -15,7 +17,18 @@ main (void)
static_assert (sizeof (util::point4f) == 4 * sizeof (util::point4f::value_type), "point4f is not packed"); static_assert (sizeof (util::point4f) == 4 * sizeof (util::point4f::value_type), "point4f is not packed");
util::TAP::logger t; util::TAP::logger t;
t.expect (true, "packing tests");
constexpr util::point2i p { -1, 2 };
t.expect_eq (-p, util::point2i { 1, -2 }, "unary point negation");
t.expect_eq ( p, p, "unary point addition");
t.expect (
std::is_same<
bool,
decltype(!p)::value_type
>::value,
"unary point boolean negation has type bool"
);
return t.status (); return t.status ();
} }