| 9 | #include "planar_implicit.h" |
| 10 | |
| 11 | void test_square() { |
| 12 | std::vector<Line> s = { |
| 13 | Line(Point(0, 0), Point(0, 1)), |
| 14 | Line(Point(0, 0), Point(1, 0)), |
| 15 | Line(Point(1, 1), Point(0, 1)), |
| 16 | Line(Point(1, 1), Point(1, 0)), |
| 17 | Line(Point(0, 0), Point(1, 1)), |
| 18 | Line(Point(1, 0), Point(0, 1)) |
| 19 | }; |
| 20 | auto [pts, adj] = build_graph(s); |
| 21 | std::vector<Point> pts1 = {Point(0, 0), Point(0, 1), Point(1, 0), Point(1, 1), Point(0.5, 0.5)}; |
| 22 | assert(pts == pts1); |
| 23 | std::sort(adj[4].begin(), adj[4].end()); |
| 24 | std::vector<size_t> adj1 = {0, 1, 2, 3}; |
| 25 | assert(adj[4] == adj1); |
| 26 | } |
| 27 | |
| 28 | void test_grid() { |
| 29 | std::vector<Line> s = { |