mirror of
https://github.com/g-truc/glm.git
synced 2024-11-22 17:04:35 +00:00
Add tests for the functionality I implemented
This commit is contained in:
parent
4b9b39f1db
commit
c900adfe32
@ -57,12 +57,26 @@ int test_LineLineProper() {
|
||||
return Error;
|
||||
}
|
||||
|
||||
int test_overlapSegment() {
|
||||
int Error(0);
|
||||
|
||||
Error += !overlapSegment(vec2(0, 1), vec2(2, 1), vec2(1, 1), vec2(1, 2)) ? 0 : 1;
|
||||
Error += !overlapSegment(vec2(0, 1), vec2(2, 1), vec2(1, 2), vec2(1, 1)) ? 0 : 1;
|
||||
Error += !overlapSegment(vec2(0, 0), vec2(0, 1), vec2(0, 1), vec2(0, 2)) ? 0 : 1;
|
||||
Error += overlapSegment(vec2(0, 0), vec2(0, 1), vec2(0, 0.5), vec2(0, 2)) ? 0 : 1;
|
||||
Error += overlapSegment(vec2(0.5, 1), vec2(2, 2.5), vec2(1, 1.5), vec2(1.5, 2)) ? 0 : 1;
|
||||
Error += !overlapSegment(vec2(0.5, 1), vec2(2, 2.5), vec2(1, 1.51), vec2(1.5, 2)) ? 0 : 1;
|
||||
|
||||
return Error;
|
||||
}
|
||||
|
||||
int main()
|
||||
{
|
||||
int Error(0);
|
||||
|
||||
Error += test_LineLine();
|
||||
Error += test_LineLineProper();
|
||||
Error += test_overlapSegment();
|
||||
|
||||
return Error;
|
||||
}
|
||||
|
@ -55,6 +55,16 @@ int test_areCollinear()
|
||||
Error += TestA ? 0 : 1;
|
||||
}
|
||||
|
||||
{
|
||||
bool TestA = glm::areCollinear(glm::vec2(0, 0), glm::vec2(1, 1), glm::vec2(2, 2));
|
||||
Error += TestA ? 0 : 1;
|
||||
}
|
||||
|
||||
{
|
||||
bool TestA = glm::areCollinear(glm::vec2(0, 0), glm::vec2(1, 1), glm::vec2(4, 2));
|
||||
Error += !TestA ? 0 : 1;
|
||||
}
|
||||
|
||||
return Error;
|
||||
}
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user