test_first_order_filter.cpp
Go to the documentation of this file.
1 /*
2  * Copyright 2018 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 
21 #include <first_order_filter.h>
22 
23 TEST(FirstOrderFilter, PassThrough)
24 {
26 
27  ASSERT_EQ(flt.update(0.0), 0.0);
28  ASSERT_EQ(flt.update(1.0), 1.0);
29  ASSERT_EQ(flt.update(2.0), 2.0);
30 }
31 
33 {
34  FirstOrderLPF<double> flt(100);
35 
36  ASSERT_EQ(flt.update(0.0), 0.0);
37  for (size_t i = 0; i < 100 - 1; ++i)
38  flt.update(1.0);
39  ASSERT_NEAR(flt.update(1.0), 1.0 - 1.0 / std::exp(1), 1e-2);
40 }
41 
43 {
44  FirstOrderHPF<double> flt(100);
45 
46  ASSERT_EQ(flt.update(0.0), 0.0);
47  for (size_t i = 0; i < 100 - 2; ++i)
48  flt.update(1.0);
49  ASSERT_NEAR(flt.update(1.0), 1.0 / std::exp(1), 1e-2);
50 }
51 
52 int main(int argc, char **argv)
53 {
54  testing::InitGoogleTest(&argc, argv);
55 
56  return RUN_ALL_TESTS();
57 }
FLT update(const FLT &in)
TEST(FirstOrderFilter, PassThrough)
int main(int argc, char **argv)


urg_stamped
Author(s): Atsushi Watanabe
autogenerated on Thu Jun 6 2019 19:55:59