aboutsummaryrefslogtreecommitdiffstatshomepage
path: root/test/deco_test.c
blob: c71b8def4b44c170005bade787ca747a13e00843 (plain) (blame)
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
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
/* SPDX-License-Identifier: MIT-0 */

#include "minunit/minunit.h"

#include "src/deco.h"
#include "src/units.h"

MU_TEST(test_bar_to_msw)
{
    mu_assert_double_eq(10, bar_to_msw(1));
}

MU_TEST(test_msw_to_bar)
{
    mu_assert_double_eq(1, msw_to_bar(10));
}

MU_TEST(test_abs_gauge)
{
    mu_assert_double_eq(1, abs_depth(gauge_depth(1)));
}

MU_TEST(test_gas)
{
    gas_t foo = gas_new(21, 35, MOD_AUTO);
    gas_t baz = gas_new(21, 35, MOD_AUTO);
    gas_t qux = gas_new(21, 35, 99);

    mu_assert_int_eq(21, gas_o2(&foo));
    mu_assert_int_eq(35, gas_he(&foo));
    mu_assert_int_eq(44, gas_n2(&foo));

    mu_check(gas_equal(&foo, &foo));
    mu_check(gas_equal(&foo, &baz));
    mu_check(!gas_equal(&foo, &qux));
}

void testsuite_deco_setup(void)
{
}

void testsuite_deco_teardown(void)
{
}

MU_TEST_SUITE(testsuite_deco)
{
    MU_SUITE_CONFIGURE(&testsuite_deco_setup, &testsuite_deco_teardown);

    MU_RUN_TEST(test_bar_to_msw);
    MU_RUN_TEST(test_msw_to_bar);
    MU_RUN_TEST(test_abs_gauge);
    MU_RUN_TEST(test_gas);
}