38 #include <gtest/gtest.h>
45 TEST(VelocityIteratorTest, testsingle) {
49 result[i] = x_it.getVelocity();
53 EXPECT_EQ(0, result[0]);
56 TEST(VelocityIteratorTest, testsingle_pos) {
60 result[i] = x_it.getVelocity();
64 EXPECT_EQ(2.2, result[0]);
67 TEST(VelocityIteratorTest, testsingle_neg) {
71 result[i] = x_it.getVelocity();
75 EXPECT_EQ(-3.3, result[0]);
78 TEST(VelocityIteratorTest, test1) {
82 result[i] = x_it.getVelocity();
86 double expected [3]= {-30.0, 0.0, 30.0};
87 for (
int j = 0; j < 3; ++j) {
88 EXPECT_EQ(expected[j], result[j]);
92 TEST(VelocityIteratorTest, test1_pos) {
96 result[i] = x_it.getVelocity();
100 double expected [2]= {10.0, 30.0};
101 for (
int j = 0; j < 2; ++j) {
102 EXPECT_EQ(expected[j], result[j]);
106 TEST(VelocityIteratorTest, test1_neg) {
110 result[i] = x_it.getVelocity();
114 double expected [2]= {-30.0, -10.0};
115 for (
int j = 0; j < 2; ++j) {
116 EXPECT_EQ(expected[j], result[j]);
120 TEST(VelocityIteratorTest, test3) {
124 result[i] = x_it.getVelocity();
128 double expected [3]= {-30.0, 0.0, 30};
129 for (
int j = 0; j < 3; ++j) {
130 EXPECT_EQ(expected[j], result[j]);
134 TEST(VelocityIteratorTest, test4) {
138 result[i] = x_it.getVelocity();
142 double expected [5]= {-30.0, -10.0, 0.0, 10.0, 30};
143 for (
int j = 0; j < 5; ++j) {
144 EXPECT_EQ(expected[j], result[j]);
148 TEST(VelocityIteratorTest, test_shifted) {
153 result[i] = x_it.getVelocity();
157 double expected [5]= {-10.0, 0.0, 10.0, 30, 50};
158 for (
int j = 0; j < 5; ++j) {
159 EXPECT_EQ(expected[j], result[j]);
163 TEST(VelocityIteratorTest, test_cranky) {
168 result[i] = x_it.getVelocity();
172 for (
int j = 0; j < 5; ++j) {
173 double expected [5]= {-10.00001, -0.000005, 0.0, 10.0};
174 EXPECT_FLOAT_EQ(expected[j], result[j]);