Skip to content

Commit 4ff4329

Browse files
committed
ticker test: add fire now stub
1 parent 10ea63b commit 4ff4329

File tree

1 file changed

+10
-6
lines changed

1 file changed

+10
-6
lines changed

TESTS/mbed_hal/ticker/main.cpp

Lines changed: 10 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -42,6 +42,7 @@ struct ticker_interface_stub_t {
4242
unsigned int disable_interrupt_call;
4343
unsigned int clear_interrupt_call;
4444
unsigned int set_interrupt_call;
45+
unsigned int fire_interrupt_call;
4546
};
4647

4748
static ticker_interface_stub_t interface_stub = { 0 };
@@ -75,6 +76,11 @@ static void ticker_interface_stub_set_interrupt(timestamp_t timestamp)
7576
interface_stub.interrupt_timestamp = timestamp;
7677
}
7778

79+
static void ticker_interface_stub_fire_interrupt()
80+
{
81+
++interface_stub.fire_interrupt_call;
82+
}
83+
7884
static void reset_ticker_interface_stub()
7985
{
8086
interface_stub.interface.init = ticker_interface_stub_init;
@@ -84,6 +90,7 @@ static void reset_ticker_interface_stub()
8490
interface_stub.interface.clear_interrupt =
8591
ticker_interface_stub_clear_interrupt;
8692
interface_stub.interface.set_interrupt =ticker_interface_stub_set_interrupt;
93+
interface_stub.interface.fire_interrupt = ticker_interface_stub_fire_interrupt;
8794
interface_stub.initialized = false;
8895
interface_stub.interrupt_flag = false;
8996
interface_stub.timestamp = 0;
@@ -93,6 +100,7 @@ static void reset_ticker_interface_stub()
93100
interface_stub.disable_interrupt_call = 0;
94101
interface_stub.clear_interrupt_call = 0;
95102
interface_stub.set_interrupt_call = 0;
103+
interface_stub.fire_interrupt_call = 0;
96104
}
97105

98106
// stub of the event queue
@@ -949,11 +957,7 @@ static void test_insert_event_us_underflow()
949957
);
950958

951959
TEST_ASSERT_EQUAL_PTR(&event, queue_stub.head);
952-
TEST_ASSERT_EQUAL_UINT32(
953-
interface_stub.timestamp,
954-
interface_stub.interrupt_timestamp
955-
);
956-
TEST_ASSERT_EQUAL(1, interface_stub.set_interrupt_call);
960+
TEST_ASSERT_EQUAL(1, interface_stub.fire_interrupt_call);
957961

958962
TEST_ASSERT_EQUAL(0, interface_stub.disable_interrupt_call);
959963
}
@@ -2079,4 +2083,4 @@ int main()
20792083
{
20802084
Specification specification(greentea_test_setup, cases, greentea_test_teardown_handler);
20812085
return !Harness::run(specification);
2082-
}
2086+
}

0 commit comments

Comments
 (0)