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)
|
|
|
|
{
|
2018-08-05 14:42:02 +10:00
|
|
|
cruft::TAP::logger tap;
|
2015-09-22 17:23:54 +10:00
|
|
|
|
|
|
|
{
|
2018-08-05 14:42:02 +10:00
|
|
|
constexpr const cruft::extent2u hi { 8, 4 };
|
|
|
|
constexpr const cruft::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
|
|
|
{
|
2018-08-05 14:42:02 +10:00
|
|
|
static constexpr cruft::point2u EXPECTED[] = {
|
2015-09-29 17:32:11 +10:00
|
|
|
{ 0, 0 }, { 1, 0 }, { 2, 0 },
|
|
|
|
{ 0, 1 }, { 1, 1 }, { 2, 1 },
|
|
|
|
};
|
|
|
|
|
|
|
|
size_t offset = 0;
|
2018-03-23 16:38:54 +11:00
|
|
|
bool success = true;
|
2015-09-29 17:32:11 +10:00
|
|
|
|
2018-08-05 14:42:02 +10:00
|
|
|
for (auto p: cruft::extent2u {3,2}.step ()) {
|
2018-03-23 16:38:54 +11:00
|
|
|
if (offset >= std::size (EXPECTED)) {
|
|
|
|
success = false;
|
|
|
|
break;
|
|
|
|
}
|
2015-09-29 17:32:11 +10:00
|
|
|
|
2018-08-05 14:42:02 +10:00
|
|
|
success = success && cruft::all (EXPECTED[offset++] == p);
|
2018-03-23 16:38:54 +11:00
|
|
|
}
|
|
|
|
|
|
|
|
tap.expect (success, "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
|
|
|
}
|