summaryrefslogtreecommitdiffstats
path: root/serial_link/tests/frame_validator_tests.c
diff options
context:
space:
mode:
Diffstat (limited to 'serial_link/tests/frame_validator_tests.c')
-rw-r--r--serial_link/tests/frame_validator_tests.c24
1 files changed, 12 insertions, 12 deletions
diff --git a/serial_link/tests/frame_validator_tests.c b/serial_link/tests/frame_validator_tests.c
index 6f9b746f69..49c61d1e4d 100644
--- a/serial_link/tests/frame_validator_tests.c
+++ b/serial_link/tests/frame_validator_tests.c
@@ -26,11 +26,11 @@ SOFTWARE.
#include <cgreen/mocks.h>
#include "protocol/frame_validator.c"
-void route_incoming_frame(uint8_t* data, uint16_t size) {
+void route_incoming_frame(uint8_t link, uint8_t* data, uint16_t size) {
mock(data, size);
}
-void send_frame(uint8_t* data, uint16_t size) {
+void send_frame(uint8_t link, uint8_t* data, uint16_t size) {
mock(data, size);
}
@@ -41,10 +41,10 @@ AfterEach(FrameValidator) {}
Ensure(FrameValidator, doesnt_validate_frames_under_5_bytes) {
never_expect(route_incoming_frame);
uint8_t data[] = {1, 2};
- validator_recv_frame(0, 1);
- validator_recv_frame(data, 2);
- validator_recv_frame(data, 3);
- validator_recv_frame(data, 4);
+ validator_recv_frame(0, 0, 1);
+ validator_recv_frame(0, data, 2);
+ validator_recv_frame(0, data, 3);
+ validator_recv_frame(0, data, 4);
}
Ensure(FrameValidator, validates_one_byte_frame_with_correct_crc) {
@@ -53,13 +53,13 @@ Ensure(FrameValidator, validates_one_byte_frame_with_correct_crc) {
when(size, is_equal_to(1)),
when(data, is_equal_to_contents_of(data, 1))
);
- validator_recv_frame(data, 5);
+ validator_recv_frame(0, data, 5);
}
Ensure(FrameValidator, does_not_validate_one_byte_frame_with_incorrect_crc) {
uint8_t data[] = {0x44, 0, 0, 0, 0};
never_expect(route_incoming_frame);
- validator_recv_frame(data, 5);
+ validator_recv_frame(1, data, 5);
}
Ensure(FrameValidator, validates_four_byte_frame_with_correct_crc) {
@@ -68,7 +68,7 @@ Ensure(FrameValidator, validates_four_byte_frame_with_correct_crc) {
when(size, is_equal_to(4)),
when(data, is_equal_to_contents_of(data, 4))
);
- validator_recv_frame(data, 8);
+ validator_recv_frame(1, data, 8);
}
Ensure(FrameValidator, validates_five_byte_frame_with_correct_crc) {
@@ -77,7 +77,7 @@ Ensure(FrameValidator, validates_five_byte_frame_with_correct_crc) {
when(size, is_equal_to(5)),
when(data, is_equal_to_contents_of(data, 5))
);
- validator_recv_frame(data, 9);
+ validator_recv_frame(0, data, 9);
}
Ensure(FrameValidator, sends_one_byte_with_correct_crc) {
@@ -87,7 +87,7 @@ Ensure(FrameValidator, sends_one_byte_with_correct_crc) {
when(size, is_equal_to(sizeof(expected))),
when(data, is_equal_to_contents_of(expected, sizeof(expected)))
);
- validator_send_frame(original, 1);
+ validator_send_frame(0, original, 1);
}
Ensure(FrameValidator, sends_five_bytes_with_correct_crc) {
@@ -97,5 +97,5 @@ Ensure(FrameValidator, sends_five_bytes_with_correct_crc) {
when(size, is_equal_to(sizeof(expected))),
when(data, is_equal_to_contents_of(expected, sizeof(expected)))
);
- validator_send_frame(original, 5);
+ validator_send_frame(0, original, 5);
}