cpp02/ex03/main.cpp

18 lines
667 B
C++
Raw Permalink Normal View History

2025-05-15 10:55:59 +02:00
#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;
}