2015-09-21 15:27:36 +10:00
|
|
|
#include "tap.hpp"
|
|
|
|
#include "point.hpp"
|
2016-08-11 14:58:46 +10:00
|
|
|
#include "vector.hpp"
|
2015-09-21 15:27:36 +10:00
|
|
|
|
2016-03-14 22:32:52 +11:00
|
|
|
#include "coord/iostream.hpp"
|
|
|
|
|
2015-09-21 15:27:36 +10:00
|
|
|
int
|
|
|
|
main (void)
|
|
|
|
{
|
|
|
|
static_assert (sizeof (util::point1u) == 1 * sizeof (util::point1u::value_type), "point1u is not packed");
|
|
|
|
static_assert (sizeof (util::point2u) == 2 * sizeof (util::point2u::value_type), "point2u is not packed");
|
|
|
|
static_assert (sizeof (util::point3u) == 3 * sizeof (util::point3u::value_type), "point3u is not packed");
|
|
|
|
static_assert (sizeof (util::point4u) == 4 * sizeof (util::point4u::value_type), "point4u is not packed");
|
|
|
|
|
|
|
|
static_assert (sizeof (util::point1f) == 1 * sizeof (util::point1f::value_type), "point1f is not packed");
|
|
|
|
static_assert (sizeof (util::point2f) == 2 * sizeof (util::point2f::value_type), "point2f is not packed");
|
|
|
|
static_assert (sizeof (util::point3f) == 3 * sizeof (util::point3f::value_type), "point3f is not packed");
|
|
|
|
static_assert (sizeof (util::point4f) == 4 * sizeof (util::point4f::value_type), "point4f is not packed");
|
|
|
|
|
|
|
|
util::TAP::logger t;
|
2016-03-14 22:32:52 +11:00
|
|
|
|
|
|
|
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"
|
|
|
|
);
|
2015-09-21 15:27:36 +10:00
|
|
|
|
2016-08-11 14:58:46 +10:00
|
|
|
auto vec = util::vector4f (0.5f);
|
|
|
|
t.expect_eq (vec, util::normalised (vec), "normalisation of normalised vector");
|
|
|
|
|
2016-12-12 17:04:22 +11:00
|
|
|
t.expect_eq (sum (util::vector4f::ones ()), 4.f, "elementwise summation");
|
2016-08-15 18:46:04 +10:00
|
|
|
|
2015-09-21 15:27:36 +10:00
|
|
|
return t.status ();
|
|
|
|
}
|