summaryrefslogtreecommitdiffstats
path: root/serial_link/tests/frame_router_tests.c
diff options
context:
space:
mode:
authorFred Sundvik <fsundvik@gmail.com>2016-02-20 15:14:40 +0200
committerFred Sundvik <fsundvik@gmail.com>2016-02-20 15:14:40 +0200
commit532f98eef6a29ae83d7ed61fbc4e25e23ad972d5 (patch)
tree55022ea7f326feac65c3ea1ea77b0af9f91cf1ae /serial_link/tests/frame_router_tests.c
parentc28e19c5467e92f532f64db020ad4817b531dbec (diff)
Support for other links sending to master
Diffstat (limited to 'serial_link/tests/frame_router_tests.c')
-rw-r--r--serial_link/tests/frame_router_tests.c25
1 files changed, 24 insertions, 1 deletions
diff --git a/serial_link/tests/frame_router_tests.c b/serial_link/tests/frame_router_tests.c
index 02e6367d21..6b00aca677 100644
--- a/serial_link/tests/frame_router_tests.c
+++ b/serial_link/tests/frame_router_tests.c
@@ -155,7 +155,7 @@ Ensure(FrameRouter, master_send_is_received_by_targets) {
assert_that(router_buffers[3].send_buffers[UP_LINK].sent_data_size, is_equal_to(0));
}
-Ensure(FrameRouter, first_sends_to_master) {
+Ensure(FrameRouter, first_link_sends_to_master) {
frame_buffer_t data;
data.data = 0xAB7055BB;
activate_router(1);
@@ -172,3 +172,26 @@ Ensure(FrameRouter, first_sends_to_master) {
assert_that(router_buffers[0].send_buffers[DOWN_LINK].sent_data_size, is_equal_to(0));
assert_that(router_buffers[0].send_buffers[UP_LINK].sent_data_size, is_equal_to(0));
}
+
+Ensure(FrameRouter, second_link_sends_to_master) {
+ printf("Second to master start\n");
+ frame_buffer_t data;
+ data.data = 0xAB7055BB;
+ activate_router(2);
+ router_send_frame(0, (uint8_t*)&data, 4);
+ assert_that(router_buffers[2].send_buffers[UP_LINK].sent_data_size, is_greater_than(0));
+ assert_that(router_buffers[2].send_buffers[DOWN_LINK].sent_data_size, is_equal_to(0));
+
+ simulate_transport(2, 1);
+ assert_that(router_buffers[1].send_buffers[UP_LINK].sent_data_size, is_greater_than(0));
+ assert_that(router_buffers[1].send_buffers[DOWN_LINK].sent_data_size, is_equal_to(0));
+
+ expect(transport_recv_frame,
+ when(from, is_equal_to(2)),
+ when(size, is_equal_to(4)),
+ when(data, is_equal_to_contents_of(&data.data, 4))
+ );
+ simulate_transport(1, 0);
+ assert_that(router_buffers[0].send_buffers[DOWN_LINK].sent_data_size, is_equal_to(0));
+ assert_that(router_buffers[0].send_buffers[UP_LINK].sent_data_size, is_equal_to(0));
+}