test_first_order_filter.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 
19 #include <cmath>
20 
22 
23 namespace urg_stamped
24 {
25 TEST(FirstOrderFilter, PassThrough)
26 {
28 
29  ASSERT_EQ(flt.update(0.0), 0.0);
30  ASSERT_EQ(flt.update(1.0), 1.0);
31  ASSERT_EQ(flt.update(2.0), 2.0);
32 }
33 
35 {
36  FirstOrderLPF<double> flt(100);
37 
38  ASSERT_EQ(flt.update(0.0), 0.0);
39  for (size_t i = 0; i < 100 - 1; ++i)
40  flt.update(1.0);
41  ASSERT_NEAR(flt.update(1.0), 1.0 - 1.0 / std::exp(1), 1e-2);
42 }
43 
45 {
46  FirstOrderHPF<double> flt(100);
47 
48  ASSERT_EQ(flt.update(0.0), 0.0);
49  for (size_t i = 0; i < 100 - 2; ++i)
50  flt.update(1.0);
51  ASSERT_NEAR(flt.update(1.0), 1.0 / std::exp(1), 1e-2);
52 }
53 } // namespace urg_stamped
54 
55 int main(int argc, char** argv)
56 {
57  testing::InitGoogleTest(&argc, argv);
58 
59  return RUN_ALL_TESTS();
60 }
TEST(DeviceTimeOriginTest, testEstimateOriginByAverage)
int main(int argc, char **argv)


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