point: add simple redim with fill test

This commit is contained in:
Danny Robson 2015-01-13 18:40:45 +11:00
parent 917ab8fc8e
commit bb0271ab2b

View File

@ -8,9 +8,33 @@ using namespace util;
int int
main (int, char**) { main (int, char**) {
const point3f p(0.f, 1.f, 2.f); // Redim to lower dimension
const point2f q = p.redim<2> (); {
const point3f p(0.f, 1.f, 2.f);
const point2f q = p.redim<2> ();
CHECK_EQ (q.data[0], p.data[0]); CHECK_EQ (q.data[0], p.data[0]);
CHECK_EQ (q.data[1], p.data[1]); CHECK_EQ (q.data[1], p.data[1]);
}
// Redim to higher dimension without fill
{
const point2f p(0.f, 1.f);
const point3f q = p.redim<3> ();
CHECK_EQ (p.data[0], q.data[0]);
CHECK_EQ (p.data[1], q.data[1]);
}
// Redim to higher dimension with fill
{
static const point4f FILL (1.f, 2.f, 3.f, 4.f);
const point2f p (0.1, 1.f);
const point4f q = p.template redim<4> (FILL);
CHECK_EQ (q.data[0], p.data[0]);
CHECK_EQ (q.data[1], p.data[1]);
CHECK_EQ (q.data[2], FILL.data[2]);
CHECK_EQ (q.data[3], FILL.data[3]);
}
} }