18 lines
667 B
C++
18 lines
667 B
C++
|
|
#include "Point.hpp"
|
||
|
|
|
||
|
|
static void assert_bsp(Point a, Point b, Point c, Point p, bool expected) {
|
||
|
|
bool result = bsp(a, b, c, p);
|
||
|
|
std::cout << "a: " << a << "\tb: " << b << "\tc: " << c << "\tp: " << p;
|
||
|
|
std::cout << "\tresult: " << result << " expected: " << expected << std::endl;
|
||
|
|
if (result != expected)
|
||
|
|
throw 0;
|
||
|
|
}
|
||
|
|
|
||
|
|
int main(void) {
|
||
|
|
assert_bsp(Point(0, 0), Point(20, 0), Point(10, 30), Point(10, 15), true);
|
||
|
|
assert_bsp(Point(0, 0), Point(0, 0), Point(0, 0), Point(0, 0), false);
|
||
|
|
assert_bsp(Point(0, 0), Point(20, 0), Point(30, 0), Point(15, 0), false);
|
||
|
|
assert_bsp(Point(0, 0), Point(20, 0), Point(30, 10), Point(15, 10.1f), false);
|
||
|
|
return 0;
|
||
|
|
}
|