diff options
author | Christopher Peplin <chris.peplin@rhubarbtech.com> | 2014-01-01 16:08:10 -0500 |
---|---|---|
committer | Christopher Peplin <chris.peplin@rhubarbtech.com> | 2014-01-01 16:10:57 -0500 |
commit | 482c7eafcb35a4031ab6f2241b14ac495735b7cd (patch) | |
tree | 8fdff5d9e5ae49df5ed0909dfdb8fc628674ed80 /tests | |
parent | 8702b34a8ffdf220c9b054d8f1950a82c9387d6a (diff) |
Return completed rx messages instead of relying on callbacks.
Diffstat (limited to 'tests')
-rw-r--r-- | tests/test_receive.c | 12 |
1 files changed, 8 insertions, 4 deletions
diff --git a/tests/test_receive.c b/tests/test_receive.c index 0559c065..2ce3feff 100644 --- a/tests/test_receive.c +++ b/tests/test_receive.c @@ -28,7 +28,8 @@ extern void setup(); START_TEST (test_receive_wrong_id) { const uint8_t data[CAN_MESSAGE_BYTE_SIZE] = {0}; - fail_if(isotp_receive_can_frame(&SHIMS, &HANDLE, 0x100, data, 1)); + IsoTpMessage message = isotp_receive_can_frame(&SHIMS, &HANDLE, 0x100, data, 1); + fail_if(message.completed); fail_if(message_was_received); } END_TEST @@ -37,7 +38,8 @@ START_TEST (test_receive_bad_pci) { // 4 is a reserved number for the PCI field - only 0-3 are allowed const uint8_t data[CAN_MESSAGE_BYTE_SIZE] = {0x40}; - fail_if(isotp_receive_can_frame(&SHIMS, &HANDLE, 0x2a, data, 1)); + IsoTpMessage message = isotp_receive_can_frame(&SHIMS, &HANDLE, 0x2a, data, 1); + fail_if(message.completed); fail_if(message_was_received); } END_TEST @@ -45,7 +47,8 @@ END_TEST START_TEST (test_receive_single_frame_empty_payload) { const uint8_t data[CAN_MESSAGE_BYTE_SIZE] = {0x00, 0x12, 0x34}; - fail_unless(isotp_receive_can_frame(&SHIMS, &HANDLE, 0x2a, data, 3)); + IsoTpMessage message = isotp_receive_can_frame(&SHIMS, &HANDLE, 0x2a, data, 3); + fail_unless(message.completed); fail_unless(message_was_received); ck_assert_int_eq(last_message_received_arb_id, 0x2a); ck_assert_int_eq(last_message_received_payload_size, 0); @@ -55,7 +58,8 @@ END_TEST START_TEST (test_receive_single_frame) { const uint8_t data[CAN_MESSAGE_BYTE_SIZE] = {0x02, 0x12, 0x34}; - fail_unless(isotp_receive_can_frame(&SHIMS, &HANDLE, 0x2a, data, 3)); + IsoTpMessage message = isotp_receive_can_frame(&SHIMS, &HANDLE, 0x2a, data, 3); + fail_unless(message.completed); fail_unless(message_was_received); ck_assert_int_eq(last_message_received_arb_id, 0x2a); ck_assert_int_eq(last_message_received_payload_size, 2); |