diff options
author | Fred Sundvik <fsundvik@gmail.com> | 2016-02-20 14:52:17 +0200 |
---|---|---|
committer | Fred Sundvik <fsundvik@gmail.com> | 2016-02-20 14:52:17 +0200 |
commit | 82b5037b9db628c3f34d8fb38848753ff3e41e2f (patch) | |
tree | a30ebc072be36b6cc40fb6cabae28602fcb2eb1e /serial_link/tests | |
parent | cee5406ed76f16670a54720b8d3c6d8f8c193c49 (diff) |
Add master send to specific destinations
Diffstat (limited to 'serial_link/tests')
-rw-r--r-- | serial_link/tests/frame_router_tests.c | 32 |
1 files changed, 32 insertions, 0 deletions
diff --git a/serial_link/tests/frame_router_tests.c b/serial_link/tests/frame_router_tests.c index eb0c710ea1..7a4ccb0c40 100644 --- a/serial_link/tests/frame_router_tests.c +++ b/serial_link/tests/frame_router_tests.c @@ -120,3 +120,35 @@ Ensure(ByteStuffer, master_broadcast_is_received_by_everyone) { assert_that(router_buffers[2].send_buffers[DOWN_LINK].sent_data_size, is_greater_than(0)); assert_that(router_buffers[2].send_buffers[UP_LINK].sent_data_size, is_equal_to(0)); } + +Ensure(ByteStuffer, master_send_is_received_by_targets) { + printf("Here\n"); + frame_buffer_t data; + data.data = 0xAB7055BB; + activate_router(0); + router_send_frame((1 << 1) | (1 << 2), (uint8_t*)&data, 4); + assert_that(router_buffers[0].send_buffers[DOWN_LINK].sent_data_size, is_greater_than(0)); + assert_that(router_buffers[0].send_buffers[UP_LINK].sent_data_size, is_equal_to(0)); + + simulate_transport(0, 1); + assert_that(router_buffers[1].send_buffers[DOWN_LINK].sent_data_size, is_greater_than(0)); + assert_that(router_buffers[1].send_buffers[UP_LINK].sent_data_size, is_equal_to(0)); + + expect(transport_recv_frame, + when(from, is_equal_to(0)), + when(size, is_equal_to(4)), + when(data, is_equal_to_contents_of(&data.data, 4)) + ); + simulate_transport(1, 2); + assert_that(router_buffers[2].send_buffers[DOWN_LINK].sent_data_size, is_greater_than(0)); + assert_that(router_buffers[2].send_buffers[UP_LINK].sent_data_size, is_equal_to(0)); + + expect(transport_recv_frame, + when(from, is_equal_to(0)), + when(size, is_equal_to(4)), + when(data, is_equal_to_contents_of(&data.data, 4)) + ); + simulate_transport(2, 3); + assert_that(router_buffers[3].send_buffers[DOWN_LINK].sent_data_size, is_greater_than(0)); + assert_that(router_buffers[3].send_buffers[UP_LINK].sent_data_size, is_equal_to(0)); +} |