Skip to content

Commit

Permalink
improve testgeom organization
Browse files Browse the repository at this point in the history
  • Loading branch information
no-lex committed Mar 18, 2024
1 parent ae34423 commit 21e73bf
Showing 1 changed file with 25 additions and 17 deletions.
42 changes: 25 additions & 17 deletions test/testgeom.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,10 @@

constexpr float tolerance = 0.001;

////////////////////////////////////////////////////////////////////////////////
// float vec tests
////////////////////////////////////////////////////////////////////////////////

void test_vec_lerp()
{
std::printf("testing vec lerp\n");
Expand Down Expand Up @@ -53,6 +57,25 @@ void test_vec_lerp()
}
}

////////////////////////////////////////////////////////////////////////////////
// integer vec tests
////////////////////////////////////////////////////////////////////////////////

void test_ivec_dist()
{
std::printf("testing ivec dist\n");
{
plane p(vec(0,0,1), 0);
ivec i(1,1,1);
assert(i.dist(p) == 1);
}
{
plane p(vec(0,0,1), 0);
ivec i(1,1,0);
assert(i.dist(p) == 0);
}
}

void test_raysphereintersect()
{
std::printf("testing raysphereintersect\n");
Expand Down Expand Up @@ -347,22 +370,6 @@ void test_polyclip()
}
}

void test_ivec_dist()
{
std::printf("testing ivec dist\n");

{
plane p(vec(0,0,1), 0);
ivec i(1,1,1);
assert(i.dist(p) == 1);
}
{
plane p(vec(0,0,1), 0);
ivec i(1,1,0);
assert(i.dist(p) == 0);
}
}

void test_mod360()
{
std::printf("testing mod360\n");
Expand Down Expand Up @@ -417,10 +424,11 @@ testing geometry\n\

test_vec_lerp();

test_ivec_dist();

test_raysphereintersect();
test_linecylinderintersect();
test_polyclip();
test_ivec_dist();
test_mod360();
test_sin360();
test_cos360();
Expand Down

0 comments on commit 21e73bf

Please sign in to comment.