2015-02-13 17:32:31 +11:00
|
|
|
#include "extent.hpp"
|
2015-04-13 16:45:56 +10:00
|
|
|
#include "tap.hpp"
|
2015-09-29 17:32:11 +10:00
|
|
|
#include "types.hpp"
|
2015-02-13 17:32:31 +11:00
|
|
|
|
|
|
|
int
|
|
|
|
main (void)
|
|
|
|
{
|
2015-04-13 16:45:56 +10:00
|
|
|
util::TAP::logger tap;
|
2015-09-22 17:23:54 +10:00
|
|
|
|
|
|
|
{
|
2017-08-27 12:28:56 +10:00
|
|
|
constexpr const util::extent2u hi { 8, 4 };
|
|
|
|
constexpr const util::extent2u lo { 6, 2 };
|
2015-09-22 17:23:54 +10:00
|
|
|
tap.expect_eq (lo, hi.contracted (2), "extent scalar contraction by value");
|
|
|
|
}
|
|
|
|
|
2015-09-29 17:32:11 +10:00
|
|
|
{
|
2017-08-27 12:28:56 +10:00
|
|
|
static constexpr util::point2u EXPECTED[] = {
|
2015-09-29 17:32:11 +10:00
|
|
|
{ 0, 0 }, { 1, 0 }, { 2, 0 },
|
|
|
|
{ 0, 1 }, { 1, 1 }, { 2, 1 },
|
|
|
|
{ 0, 2 }, { 1, 2 }, { 2, 2 },
|
|
|
|
};
|
|
|
|
|
|
|
|
size_t offset = 0;
|
|
|
|
unsigned success = 0;
|
|
|
|
|
|
|
|
for (auto p: util::extent_range2u ({3, 3}))
|
|
|
|
success += EXPECTED[offset++] == p ? 1 : 0;
|
|
|
|
|
2016-11-17 18:06:39 +11:00
|
|
|
tap.expect_eq (success, std::size (EXPECTED), "extent_range2u iteration");
|
2015-09-29 17:32:11 +10:00
|
|
|
}
|
|
|
|
|
2015-09-22 17:23:54 +10:00
|
|
|
return tap.status ();
|
2015-02-13 17:32:31 +11:00
|
|
|
}
|