]> rtime.felk.cvut.cz Git - hubacji1/bcar.git/blob - ut/pslot.t.cc
Merge branch 'refactor'
[hubacji1/bcar.git] / ut / pslot.t.cc
1 #include <cmath>
2 #include "wvtest.h"
3
4 #include "pslot.hh"
5
6 WVTEST_MAIN("pslot basic geometry")
7 {
8         ParkingSlot ps = ParkingSlot();
9         ps.set_slot(0.5, 1.5, M_PI/4, sqrt(2), sqrt(8));
10
11         // slot info
12         WVPASSEQ_DOUBLE(ps.x1(), 1, 0.00001);
13         WVPASSEQ_DOUBLE(ps.y1(), 1, 0.00001);
14         WVPASSEQ_DOUBLE(ps.x2(), 3, 0.00001);
15         WVPASSEQ_DOUBLE(ps.y2(), 3, 0.00001);
16         WVPASSEQ_DOUBLE(ps.x3(), 2, 0.00001);
17         WVPASSEQ_DOUBLE(ps.y3(), 4, 0.00001);
18         WVPASSEQ_DOUBLE(ps.x4(), 0, 0.00001);
19         WVPASSEQ_DOUBLE(ps.y4(), 2, 0.00001);
20         WVPASS(ps.right());
21         WVPASS(!ps.parallel());
22         WVPASSEQ_DOUBLE(ps.heading(), M_PI * 3 / 4, 0.00001);
23         ps.reverse_border();
24         WVPASSEQ_DOUBLE(ps.x1(), 0, 0.00001);
25         WVPASSEQ_DOUBLE(ps.y1(), 2, 0.00001);
26         WVPASSEQ_DOUBLE(ps.x2(), 2, 0.00001);
27         WVPASSEQ_DOUBLE(ps.y2(), 4, 0.00001);
28         WVPASSEQ_DOUBLE(ps.x3(), 3, 0.00001);
29         WVPASSEQ_DOUBLE(ps.y3(), 3, 0.00001);
30         WVPASSEQ_DOUBLE(ps.x4(), 1, 0.00001);
31         WVPASSEQ_DOUBLE(ps.y4(), 1, 0.00001);
32         WVPASS(!ps.right());
33         WVPASS(!ps.parallel());
34         WVPASSEQ_DOUBLE(ps.heading(), -M_PI / 4, 0.00001);
35 }