MCPcopy Create free account
hub / github.com/SuprDewd/CompetitiveProgramming / check

Function check

code/geometry/convex_hull.test.cpp:2–27  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

1
2void check(int mxn, int x) {
3 bool kill = true;
4 int n = randint(1,mxn);
5 polygon p;
6 rep(i,0,n) {
7 p.push_back(point(randint(0,x), randint(0,x)));
8 }
9 int cnt = convex_hull(p);
10 polygon q;
11 rep(i,0,cnt) q.push_back(hull[i]);
12 rep(i,0,size(q)) {
13 rep(j,0,i) {
14 assert_not_equal(q[i], q[j], kill);
15 }
16 }
17 if (size(q) >= 3) {
18 rep(i,0,size(q)) {
19 int j = (i+1) % size(q),
20 k = (i+2) % size(q);
21 assert_true(ccw(q[i], q[j], q[k]) < 0, kill);
22 }
23 rep(i,0,size(p)) {
24 assert_true(point_in_polygon(q, p[i]) <= 0, kill);
25 }
26 }
27}
28
29void test() {
30 /* Field testing: UVa 681 */

Callers 1

testFunction · 0.70

Calls 8

convex_hullFunction · 0.85
assert_not_equalFunction · 0.85
assert_trueFunction · 0.85
ccwFunction · 0.85
point_in_polygonFunction · 0.85
push_backMethod · 0.80
pointClass · 0.70
randintFunction · 0.50

Tested by

no test coverage detected