-
Notifications
You must be signed in to change notification settings - Fork 0
/
planner_test.cpp
94 lines (73 loc) · 1.96 KB
/
planner_test.cpp
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
/*
* planner_test.cpp
*
* Created on: Jan 1, 2013
* Author: michael
*/
#include <gtest/gtest.h>
#include "planner.h"
namespace {
// The fixture for testing class grid.
class PlannerTest : public ::testing::Test {
protected:
// You can remove any or all of the following functions if its body
// is empty.
PlannerTest() {
// You can do set-up work for each test here.
}
virtual ~PlannerTest() {
// You can do clean-up work that doesn't throw exceptions here.
}
// If the constructor and destructor are not enough for setting up
// and cleaning up each test, you can define the following methods:
virtual void SetUp() {
// Code here will be called immediately after the constructor (right
// before each test).
}
virtual void TearDown() {
// Code here will be called immediately after each test (right
// before the destructor).
}
};
TEST_F(PlannerTest, Rotate) {
Vector2d v;
v << 2, 1;
v = Planner::rotate_left(v);
EXPECT_EQ(-1, v(0));
EXPECT_EQ(2, v(1));
v = Planner::rotate_left(v);
EXPECT_EQ(-2, v(0));
EXPECT_EQ(-1, v(1));
v = Planner::rotate_left(v);
EXPECT_EQ(1, v(0));
EXPECT_EQ(-2, v(1));
v = Planner::rotate_left(v);
EXPECT_EQ(2, v(0));
EXPECT_EQ(1, v(1));
Vector2d r;
r = Planner::rotate_left(
Planner::rotate_right(v));
EXPECT_EQ(r(0), v(0));
EXPECT_EQ(r(1), v(1));
r = Planner::rotate_left(
Planner::rotate_left(
Planner::rotate_right(
Planner::rotate_right(v))));
EXPECT_EQ(r(0), v(0));
EXPECT_EQ(r(1), v(1));
r = Planner::rotate_right(
Planner::rotate_right(
Planner::rotate_right(v)));
Vector2d r1 = Planner::rotate_left(v);
EXPECT_EQ(r(0), r1(0));
EXPECT_EQ(r(1), r1(1));
}
// Tests that the grid::Bar() method does Abc.
TEST_F(PlannerTest, Start) {
planWithSimpleSetup();
}
}
int main(int argc, char **argv) {
::testing::InitGoogleTest(&argc, argv);
return RUN_ALL_TESTS();
}