// Copyright 2019 The Chromium Authors // Use of this source code is governed by a BSD-style license that can be // found in the LICENSE file. #ifndef THIRD_PARTY_1EURO_ONE_EURO_FILTER_UNITTEST_H_ #define THIRD_PARTY_1EURO_ONE_EURO_FILTER_UNITTEST_H_ #include "third_party/one_euro_filter/src/one_euro_filter.h" #include <stdlib.h> #include <time.h> #include "third_party/googletest/src/googletest/include/gtest/gtest.h" namespace one_euro_filter { namespace test { constexpr double kEpsilon = …; class OneEuroFilterTest : public testing::Test { … }; // Check default values when wrong parameters are sent to the filter TEST_F(OneEuroFilterTest, ParametersTest) { … } // Check the filter is working when sending random numbers inside the // interval [0,1] at random interval. Each filtered number should be // inside this interval TEST_F(OneEuroFilterTest, RandomValuesRandomTimestampTest) { … } // Check the filter is working when sending random numbers inside the // interval [0,1] at constant interval. Each filtered number should be // inside this interval TEST_F(OneEuroFilterTest, RandomValuesConstantTimestampTest) { … } // Check the filter is working when sending the same number at random interval. // Each filtered value should be the same TEST_F(OneEuroFilterTest, SameValuesRandomTimestampTest) { … } // Check the filter is working when sending the same number at constant // interval. Each filtered value should be the same TEST_F(OneEuroFilterTest, SameValuesConstantTimestampTest) { … } // Check if the filter is well cloned. We create a first filter, send random // values, and then we clone it. If we send the same new random values to both // filters, we should have the same filtered results TEST_F(OneEuroFilterTest, CloneTest) { … } // Check if the filter is well reset. We send random values, save the values and // results, then we reset the filter. We send again the same values and see if // we have the same results, which would be statistically impossible with 100 // random wihtout a proper resetting. TEST_F(OneEuroFilterTest, TestResetting) { … } } // namespace test } // namespace one_euro_filter #endif // THIRD_PARTY_1EURO_ONE_EURO_FILTER_UNITTEST_H_