#include #include "data_manager.h" #include "test_runner.h" #include "unity.h" RUNNER_DECLARE_TEST(test_data_manager_init_setting) { struct data_ctx ctx; data_manager_init(&ctx); TEST_ASSERT_FLOAT_WITHIN(FLT_EPSILON, 1013.25, ctx.setting); } RUNNER_DECLARE_TEST(test_data_manager_first_readings) { struct data_ctx ctx; data_manager_init(&ctx); TEST_ASSERT_FLOAT_WITHIN(FLT_EPSILON, 1019.5, ctx.pressure); data_manager_tick(&ctx); TEST_ASSERT_FLOAT_WITHIN(FLT_EPSILON, 1019.45, ctx.pressure); } RUNNER_DECLARE_TEST(test_data_manager_reinit) { struct data_ctx ctx; /* init 1 */ data_manager_init(&ctx); TEST_ASSERT_FLOAT_WITHIN(FLT_EPSILON, 1019.5, ctx.pressure); /* check re-init */ data_manager_init(&ctx); TEST_ASSERT_FLOAT_WITHIN(FLT_EPSILON, 1019.5, ctx.pressure); }