Main Page
Related Pages
Modules
Namespaces
Classes
Files
File List
File Members
unit-tests
utilities
number
stabilized
test-not-full.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
12
// Test group description:
13
// * This tests group verifies stabilized_value class.
14
//
15
// Current test description:
16
// * Verify if history is not the logic works as expected and the percentage is calculated
17
// from the history current size
18
TEST_CASE
(
"not full history"
,
"[stabilized value]"
)
19
{
20
stabilized_value< float >
stab_value( 30 );
21
CHECK_NOTHROW
( stab_value.
add
( 76.0f ) );
22
CHECK_NOTHROW
( stab_value.
add
( 76.0f ) );
23
CHECK_NOTHROW
( stab_value.
add
( 76.0f ) );
24
CHECK_NOTHROW
( stab_value.
add
( 76.0f ) );
25
CHECK
( 76.0
f
== stab_value.
get
( 0.6f ) );
26
27
CHECK_NOTHROW
( stab_value.
add
( 45.0f ) );
28
CHECK_NOTHROW
( stab_value.
add
( 45.0f ) );
29
CHECK_NOTHROW
( stab_value.
add
( 45.0f ) );
30
CHECK_NOTHROW
( stab_value.
add
( 45.0f ) );
31
CHECK_NOTHROW
( stab_value.
add
( 45.0f ) );
32
33
CHECK
( 76.0
f
== stab_value.
get
( 0.6f ) );
34
CHECK_NOTHROW
( stab_value.
add
( 45.0f ) );
// The stable value should change now (4 * 76.0 +
35
// 6 * 45.0 (total 10 values))
36
CHECK
( 45.0
f
== stab_value.
get
( 0.6f ) );
37
}
utilities::number::stabilized_value::add
void add(T val)
Definition:
stabilized-value.h:45
utilities::number
Definition:
stabilized-value.h:11
f
GLdouble f
Definition:
glad/glad/glad.h:1518
utilities::number::stabilized_value::get
T get(float stabilization_percent=0.75f) const
Definition:
stabilized-value.h:63
CHECK_NOTHROW
#define CHECK_NOTHROW(...)
Definition:
catch.hpp:17421
utilities::number::stabilized_value< float >
TEST_CASE
TEST_CASE("not full history","[stabilized value]")
Definition:
test-not-full.cpp:18
CHECK
#define CHECK(condition)
Definition:
easylogging++.h:4483
librealsense2
Author(s): Sergey Dorodnicov
, Doron Hirshberg
, Mark Horn
, Reagan Lopez
, Itay Carpis
autogenerated on Mon May 3 2021 02:50:11