aboutsummaryrefslogtreecommitdiff
path: root/test_data_manager.c
diff options
context:
space:
mode:
authorDavid Phillips <david@yeah.nah.nz>2021-02-27 22:26:22 +1300
committerDavid Phillips <david@yeah.nah.nz>2021-02-27 22:26:22 +1300
commiteaba2a7b0658f648bf32219aec0ce827c94333a0 (patch)
tree42f50d2f3c87abfb7af0149430a67afb778fd4f1 /test_data_manager.c
parent450829bab633da3bce84a9a0f6857e68e46c7eb4 (diff)
downloadaltimeter-eaba2a7b0658f648bf32219aec0ce827c94333a0.tar.xz
Make timer mandatory for data manager
The NULL check was a bit of a hack to get the test building. Probably a bad idea to leave it around, since there's no time it's sane to leave the timestamps on data manager contexts unset.
Diffstat (limited to 'test_data_manager.c')
-rw-r--r--test_data_manager.c12
1 files changed, 7 insertions, 5 deletions
diff --git a/test_data_manager.c b/test_data_manager.c
index 00b5a2a..044282b 100644
--- a/test_data_manager.c
+++ b/test_data_manager.c
@@ -3,6 +3,7 @@
#include "data_manager.h"
#include "test_runner.h"
#include "barometer.h"
+#include "timer.h"
#include "unity.h"
static int mock_baro_called;
@@ -23,18 +24,19 @@ static struct barometer mock_barometer = {
RUNNER_DECLARE_TEST(test_data_manager_init_setting)
{
struct data_ctx ctx;
+ struct timer timer;
+ get_system_timer(&timer);
reset_mock_get_baro();
- data_manager_init(&ctx, NULL, &mock_barometer);
+ data_manager_init(&ctx, &timer, &mock_barometer);
TEST_ASSERT_EQUAL(1, mock_baro_called);
}
RUNNER_DECLARE_TEST(test_data_manager_first_readings)
{
struct data_ctx ctx;
- reset_mock_get_baro();
- data_manager_init(&ctx, NULL, &mock_barometer);
- TEST_ASSERT_EQUAL(1, mock_baro_called);
-
+ struct timer timer;
+ get_system_timer(&timer);
+ data_manager_init(&ctx, &timer, &mock_barometer);
reset_mock_get_baro();
data_manager_tick(&ctx);