test_timestamp_outlier_remover.cpp
Go to the documentation of this file.
1 /*
2  * Copyright 2018-2021 The urg_stamped Authors
3  *
4  * Licensed under the Apache License, Version 2.0 (the "License");
5  * you may not use this file except in compliance with the License.
6  * You may obtain a copy of the License at
7  *
8  * http://www.apache.org/licenses/LICENSE-2.0
9  *
10  * Unless required by applicable law or agreed to in writing, software
11  * distributed under the License is distributed on an "AS IS" BASIS,
12  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13  * See the License for the specific language governing permissions and
14  * limitations under the License.
15  */
16 
17 #include <gtest/gtest.h>
18 
20 
21 namespace urg_stamped
22 {
23 TEST(TimestampOutlierRemoval, RemoveOneOutlier)
24 {
26 
27  ASSERT_EQ(remover.update(ros::Time(10.000)), ros::Time(10.000));
28  ASSERT_EQ(remover.update(ros::Time(10.105)), ros::Time(10.105));
29  ASSERT_EQ(remover.update(ros::Time(10.200)), ros::Time(10.200));
30  ASSERT_EQ(remover.update(ros::Time(10.320)), ros::Time(10.300)); // outlier
31  ASSERT_EQ(remover.update(ros::Time(10.400)), ros::Time(10.400));
32  ASSERT_EQ(remover.update(ros::Time(10.500)), ros::Time(10.500));
33 }
34 
35 TEST(TimestampOutlierRemoval, MoreThanTwoOutlier)
36 {
38 
39  ASSERT_EQ(remover.update(ros::Time(10.000)), ros::Time(10.000));
40  ASSERT_EQ(remover.update(ros::Time(10.105)), ros::Time(10.105));
41  ASSERT_EQ(remover.update(ros::Time(10.200)), ros::Time(10.200));
42  ASSERT_EQ(remover.update(ros::Time(10.320)), ros::Time(10.300)); // outlier
43  ASSERT_EQ(remover.update(ros::Time(10.440)), ros::Time(10.440)); // fix only first outlier
44 }
45 } // namespace urg_stamped
46 
47 int main(int argc, char** argv)
48 {
49  testing::InitGoogleTest(&argc, argv);
50 
51  return RUN_ALL_TESTS();
52 }
TEST(DeviceTimeOriginTest, testEstimateOriginByAverage)
int main(int argc, char **argv)
ros::Time update(const ros::Time &stamp)


urg_stamped
Author(s): Atsushi Watanabe
autogenerated on Tue May 11 2021 02:14:05