ray: convert test to TAP format
This commit is contained in:
parent
54f5f2d170
commit
7e2baf6751
32
test/ray.cpp
32
test/ray.cpp
@ -5,48 +5,54 @@
|
||||
#include "tap.hpp"
|
||||
|
||||
|
||||
//-----------------------------------------------------------------------------
|
||||
void
|
||||
test_intersect_plane (void)
|
||||
test_intersect_plane (util::TAP::logger &tap)
|
||||
{
|
||||
// trivial case: origin ray facing z, plane at unit z facing -z.
|
||||
util::ray3f l ({0,0,0}, {0,0, 1});
|
||||
util::plane3f p ({0,0,1}, {0,0,-1});
|
||||
const util::ray3f l ({0,0,0}, {0,0, 1});
|
||||
const util::plane3f p ({0,0,1}, {0,0,-1});
|
||||
|
||||
CHECK_EQ (l.intersect (p), 1);
|
||||
tap.expect_eq (l.intersect (p), 1.f, "ray-plane intersect");
|
||||
}
|
||||
|
||||
|
||||
//-----------------------------------------------------------------------------
|
||||
void
|
||||
test_intersect_aabb (void)
|
||||
test_intersect_aabb (util::TAP::logger &tap)
|
||||
{
|
||||
// trivial case: unit aabb at origin, ray from (0.5,-0.5) upwards
|
||||
util::AABB2f b {
|
||||
const util::AABB2f b {
|
||||
{ 0.f, 0.f },
|
||||
{ 1.f, 1.f }
|
||||
};
|
||||
|
||||
util::ray2f l {
|
||||
const util::ray2f l {
|
||||
{ 0.5f, -0.5f },
|
||||
{ 0.f, 1.f }
|
||||
};
|
||||
|
||||
CHECK_EQ (l.intersect (b), 0.5f);
|
||||
tap.expect_eq (l.intersect (b), 0.5f, "ray-aabb intersect");
|
||||
}
|
||||
|
||||
|
||||
//-----------------------------------------------------------------------------
|
||||
void
|
||||
test_intersect_sphere (void)
|
||||
test_intersect_sphere (util::TAP::logger &tap)
|
||||
{
|
||||
;
|
||||
}
|
||||
|
||||
|
||||
//-----------------------------------------------------------------------------
|
||||
int
|
||||
main (void)
|
||||
{
|
||||
test_intersect_plane ();
|
||||
test_intersect_aabb ();
|
||||
|
||||
util::TAP::logger tap;
|
||||
tap.todo ("convert to TAP");
|
||||
|
||||
test_intersect_plane (tap);
|
||||
test_intersect_aabb (tap);
|
||||
test_intersect_sphere (tap);
|
||||
|
||||
return tap.status ();
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user