test_basicPortsMath_test.hpp 1.17 KB
Newer Older
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
#ifndef TEST_BASICPORTSMATH_TEST
#define TEST_BASICPORTSMATH_TEST

#include "catch.hpp"
#include "../test_basicPortsMath.h"

TEST_CASE("test.BasicPortsMath", "[test_basicPortsMath]") {
    test_basicPortsMath component;
    component.init();
            component.counter = -10.0;
        component.execute();
    REQUIRE( component.result >= 0.0 );
    REQUIRE( component.result <= 0.0 );
            component.counter = -1.0;
        component.execute();
    REQUIRE( component.result >= 0.0 );
    REQUIRE( component.result <= 0.0 );
            component.counter = 0.0;
        component.execute();
    REQUIRE( component.result >= 0.0 );
    REQUIRE( component.result <= 0.0 );
            component.counter = 1.0;
        component.execute();
    REQUIRE( component.result >= 1.0 );
    REQUIRE( component.result <= 1.0 );
            component.counter = 100.0;
        component.execute();
    REQUIRE( component.result >= 100.0 );
    REQUIRE( component.result <= 100.0 );
            component.counter = 1000.0;
        component.execute();
    REQUIRE( component.result >= 100.0 );
    REQUIRE( component.result <= 100.0 );
    std::cout << "test.BasicPortsMath: success\n";
}

#endif