From 4ff432904e967579f65c50529936e636ed6b3a41 Mon Sep 17 00:00:00 2001 From: Martin Kojtal <0xc0170@gmail.com> Date: Tue, 11 Jul 2017 15:13:26 +0100 Subject: [PATCH] ticker test: add fire now stub --- TESTS/mbed_hal/ticker/main.cpp | 16 ++++++++++------ 1 file changed, 10 insertions(+), 6 deletions(-) diff --git a/TESTS/mbed_hal/ticker/main.cpp b/TESTS/mbed_hal/ticker/main.cpp index a4964a17db..698da1fff2 100644 --- a/TESTS/mbed_hal/ticker/main.cpp +++ b/TESTS/mbed_hal/ticker/main.cpp @@ -42,6 +42,7 @@ struct ticker_interface_stub_t { unsigned int disable_interrupt_call; unsigned int clear_interrupt_call; unsigned int set_interrupt_call; + unsigned int fire_interrupt_call; }; static ticker_interface_stub_t interface_stub = { 0 }; @@ -75,6 +76,11 @@ static void ticker_interface_stub_set_interrupt(timestamp_t timestamp) interface_stub.interrupt_timestamp = timestamp; } +static void ticker_interface_stub_fire_interrupt() +{ + ++interface_stub.fire_interrupt_call; +} + static void reset_ticker_interface_stub() { interface_stub.interface.init = ticker_interface_stub_init; @@ -84,6 +90,7 @@ static void reset_ticker_interface_stub() interface_stub.interface.clear_interrupt = ticker_interface_stub_clear_interrupt; interface_stub.interface.set_interrupt =ticker_interface_stub_set_interrupt; + interface_stub.interface.fire_interrupt = ticker_interface_stub_fire_interrupt; interface_stub.initialized = false; interface_stub.interrupt_flag = false; interface_stub.timestamp = 0; @@ -93,6 +100,7 @@ static void reset_ticker_interface_stub() interface_stub.disable_interrupt_call = 0; interface_stub.clear_interrupt_call = 0; interface_stub.set_interrupt_call = 0; + interface_stub.fire_interrupt_call = 0; } // stub of the event queue @@ -949,11 +957,7 @@ static void test_insert_event_us_underflow() ); TEST_ASSERT_EQUAL_PTR(&event, queue_stub.head); - TEST_ASSERT_EQUAL_UINT32( - interface_stub.timestamp, - interface_stub.interrupt_timestamp - ); - TEST_ASSERT_EQUAL(1, interface_stub.set_interrupt_call); + TEST_ASSERT_EQUAL(1, interface_stub.fire_interrupt_call); TEST_ASSERT_EQUAL(0, interface_stub.disable_interrupt_call); } @@ -2079,4 +2083,4 @@ int main() { Specification specification(greentea_test_setup, cases, greentea_test_teardown_handler); return !Harness::run(specification); -} \ No newline at end of file +}