Danny Robson
f6056153e3
This places, at long last, the core library code into the same namespace as the extended library code.
28 lines
714 B
C++
28 lines
714 B
C++
#include "tap.hpp"
|
|
|
|
#include "geom/segment.hpp"
|
|
|
|
int
|
|
main (int, char**)
|
|
{
|
|
cruft::TAP::logger tap;
|
|
|
|
static struct {
|
|
cruft::point3f a, b;
|
|
cruft::point3f q;
|
|
float distance;
|
|
const char *message;
|
|
} const TESTS[] = {
|
|
{ { 0, 0, 0 }, { 1, 1, 1 }, { 0, 0, 0 }, 0, "origin line, origin point" },
|
|
{ { 0, 0, 0 }, { 1, 1, 1 }, { 1, 1, 1 }, 0, "origin line, point on line" },
|
|
{ { 0, 1, 0 }, { 1, 1, 0 }, { 0, 0, 0 }, 1, "+x line, unit distance" },
|
|
};
|
|
|
|
for (auto const& t: TESTS) {
|
|
cruft::geom::segment3f s {t.a, t.b};
|
|
auto d = distance (s, t.q);
|
|
tap.expect_eq (d, t.distance, "%!", t.message);
|
|
}
|
|
|
|
return tap.status ();
|
|
} |