00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017
00018
00019
00020
00021
00022
00023
00024
00025
00026
00027
00028
00029
00030
00031
00032
00033
00034 #include <gtest/gtest.h>
00035 #include <nav_2d_utils/path_ops.h>
00036
00037 using nav_2d_utils::compressPlan;
00038 using nav_2d_utils::addPose;
00039
00040 TEST(CompressTest, compress_test)
00041 {
00042 nav_2d_msgs::Path2D path;
00043
00044 addPose(path, 24, 173);
00045 addPose(path, 26, 170);
00046 addPose(path, 24, 166);
00047 addPose(path, 27, 162);
00048 addPose(path, 37, 161);
00049 addPose(path, 45, 157);
00050 addPose(path, 48, 152);
00051 addPose(path, 46, 143);
00052 addPose(path, 40, 140);
00053 addPose(path, 34, 137);
00054 addPose(path, 26, 134);
00055 addPose(path, 24, 130);
00056 addPose(path, 24, 125);
00057 addPose(path, 28, 121);
00058 addPose(path, 36, 118);
00059 addPose(path, 46, 117);
00060 addPose(path, 63, 121);
00061 addPose(path, 76, 125);
00062 addPose(path, 82, 120);
00063 addPose(path, 86, 111);
00064 addPose(path, 88, 103);
00065 addPose(path, 90, 91);
00066 addPose(path, 95, 87);
00067 addPose(path, 107, 89);
00068 addPose(path, 107, 104);
00069 addPose(path, 106, 117);
00070 addPose(path, 109, 129);
00071 addPose(path, 119, 131);
00072 addPose(path, 131, 131);
00073 addPose(path, 139, 134);
00074 addPose(path, 138, 143);
00075 addPose(path, 131, 152);
00076 addPose(path, 119, 154);
00077 addPose(path, 111, 149);
00078 addPose(path, 105, 143);
00079 addPose(path, 91, 139);
00080 addPose(path, 80, 142);
00081 addPose(path, 81, 152);
00082 addPose(path, 76, 163);
00083 addPose(path, 67, 161);
00084 addPose(path, 59, 149);
00085 addPose(path, 63, 138);
00086
00087 EXPECT_EQ(41U, compressPlan(path, 0.1).poses.size());
00088 EXPECT_EQ(34U, compressPlan(path, 1.3).poses.size());
00089 EXPECT_EQ(12U, compressPlan(path, 9.5).poses.size());
00090 EXPECT_EQ(8U, compressPlan(path, 19.9).poses.size());
00091 }
00092
00093 int main(int argc, char** argv)
00094 {
00095 testing::InitGoogleTest(&argc, argv);
00096 return RUN_ALL_TESTS();
00097 }