22 #include "gmock/gmock.h" 28 using ::testing::Contains;
29 using ::testing::PrintToString;
32 MATCHER_P(ApproximatelyEquals, expected,
33 string(
"is equal to ") + PrintToString(expected)) {
34 return (arg - expected).isZero(0.001f);
37 TEST(RangeDataTest, Compression) {
38 const std::vector<Eigen::Vector3f> returns = {Eigen::Vector3f(0, 1, 2),
39 Eigen::Vector3f(4, 5, 6),
40 Eigen::Vector3f(0, 1, 2)};
41 const RangeData range_data = {
42 Eigen::Vector3f(1, 1, 1), returns, {Eigen::Vector3f(7, 8, 9)}};
44 EXPECT_TRUE(actual.origin.isApprox(Eigen::Vector3f(1, 1, 1), 1e-6));
45 EXPECT_EQ(3, actual.returns.size());
46 EXPECT_EQ(1, actual.misses.size());
47 EXPECT_TRUE(actual.misses[0].isApprox(Eigen::Vector3f(7, 8, 9), 0.001f));
50 EXPECT_EQ(3, actual.returns.size());
51 EXPECT_THAT(actual.returns,
52 Contains(ApproximatelyEquals(Eigen::Vector3f(0, 1, 2))));
53 EXPECT_THAT(actual.returns,
54 Contains(ApproximatelyEquals(Eigen::Vector3f(4, 5, 6))));
RangeData Decompress(const CompressedRangeData &compressed_range_data)
CompressedRangeData Compress(const RangeData &range_data)