summaryrefslogtreecommitdiffstats
path: root/tests
diff options
context:
space:
mode:
authorChristopher Peplin <chris.peplin@rhubarbtech.com>2013-12-27 19:04:27 -0500
committerChristopher Peplin <chris.peplin@rhubarbtech.com>2013-12-27 19:04:27 -0500
commit451ee4faa42eb304b27aeeef8c75387b4a12a614 (patch)
tree5920834e5b8d0de0434a491b42a9c03acee42ed4 /tests
parent34a7c0ca08683eb83d6b6b3d5a6a8fb2f7d5b918 (diff)
Draft progress implementing single frame rx.
Diffstat (limited to 'tests')
-rw-r--r--tests/common.c3
-rw-r--r--tests/test_receive.c6
2 files changed, 5 insertions, 4 deletions
diff --git a/tests/common.c b/tests/common.c
index fb26c4af..9aff39a1 100644
--- a/tests/common.c
+++ b/tests/common.c
@@ -26,6 +26,7 @@ void debug(const char* format, ...) {
va_list args;
va_start(args, format);
vprintf(format, args);
+ printf("\r\n");
va_end(args);
}
@@ -39,6 +40,7 @@ void mock_set_timer(uint16_t time_ms, void (*callback)) {
void message_received(const uint16_t arbitration_id, const uint8_t* payload,
const uint16_t size) {
debug("Received ISO-TP message:");
+ message_was_received = true;
log_isotp_message(arbitration_id, payload, size);
last_message_received_arb_id = arbitration_id;
last_message_received_payload_size = size;
@@ -54,7 +56,6 @@ void message_sent(const bool success, const uint16_t arbitration_id,
}
log_isotp_message(arbitration_id, payload, size);
- message_was_received = true;
last_message_sent_arb_id = arbitration_id;
last_message_sent_payload_size = size;
memcpy(last_message_sent_payload, payload, size);
diff --git a/tests/test_receive.c b/tests/test_receive.c
index 4134cfd6..2da2e897 100644
--- a/tests/test_receive.c
+++ b/tests/test_receive.c
@@ -28,7 +28,7 @@ extern void setup();
START_TEST (test_receive_wrong_id)
{
const uint8_t data[8] = {0};
- isotp_receive_can_frame(0x100, data, sizeof(data));
+ isotp_receive_can_frame(&ISOTP_HANDLER, 0x100, data, sizeof(data));
fail_if(message_was_received);
}
END_TEST
@@ -37,7 +37,7 @@ START_TEST (test_receive_bad_pci)
{
// 4 is a reserved number for the PCI field - only 0-3 are allowed
const uint8_t data[8] = {0x40};
- isotp_receive_can_frame(0x2a, data, sizeof(data));
+ isotp_receive_can_frame(&ISOTP_HANDLER, 0x2a, data, sizeof(data));
fail_if(message_was_received);
}
END_TEST
@@ -45,7 +45,7 @@ END_TEST
START_TEST (test_receive_single_frame)
{
const uint8_t data[8] = {0x0, 0x12, 0x34};
- isotp_receive_can_frame(0x2a, data, sizeof(data));
+ isotp_receive_can_frame(&ISOTP_HANDLER, 0x2a, data, sizeof(data));
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);