test-60-percent.cpp
Go to the documentation of this file.
1 // License: Apache 2.0. See LICENSE file in root directory.
2 // Copyright(c) 2020 Intel Corporation. All Rights Reserved.
3 
4 //#cmake:add-file ../../../../common/utilities/number/stabilized-value.h
5 
6 
7 #include "../../../test.h"
8 #include <../common/utilities/number/stabilized-value.h>
9 
10 using namespace utilities::number;
11 // Test group description:
12 // * This tests group verifies stabilized_value class.
13 //
14 // Current test description:
15 // * Verify if history is filled with a stable value at the required percentage , the user
16 // will get it when asked for even if other inputs exist in history
17 
18 TEST_CASE( "get 60% stability", "[stabilized value]" )
19 {
20  stabilized_value< float > stab_value( 10 );
21  CHECK_NOTHROW( stab_value.add( 55.0f ) );
22  CHECK_NOTHROW( stab_value.add( 55.0f ) );
23  CHECK_NOTHROW( stab_value.add( 55.0f ) );
24  CHECK_NOTHROW( stab_value.add( 55.0f ) );
25  CHECK_NOTHROW( stab_value.add( 55.0f ) );
26  CHECK_NOTHROW( stab_value.add( 55.0f ) );
27  CHECK_NOTHROW( stab_value.add( 60.0f ) );
28  CHECK_NOTHROW( stab_value.add( 60.0f ) );
29  CHECK_NOTHROW( stab_value.add( 60.0f ) );
30  CHECK_NOTHROW( stab_value.add( 60.0f ) );
31 
32  CHECK( 55.0f == stab_value.get( 0.6f ) );
33 }
TEST_CASE("get 60% stability","[stabilized value]")
GLdouble f
T get(float stabilization_percent=0.75f) const
#define CHECK_NOTHROW(...)
Definition: catch.hpp:17421
#define CHECK(condition)


librealsense2
Author(s): Sergey Dorodnicov , Doron Hirshberg , Mark Horn , Reagan Lopez , Itay Carpis
autogenerated on Mon May 3 2021 02:50:11