diff options
-rw-r--r-- | Makefile | 2 | ||||
m--------- | deps/bitfield-c | 10 | ||||
-rw-r--r-- | tests/common.c | 9 | ||||
-rw-r--r-- | tests/test_send.c | 3 |
4 files changed, 11 insertions, 13 deletions
@@ -1,6 +1,6 @@ CC = gcc INCLUDES = -Isrc -Ideps/bitfield-c/src -CFLAGS = $(INCLUDES) -c -w -Wall -Werror -g -ggdb -std=gnu++0x -coverage +CFLAGS = $(INCLUDES) -c -Wall -Werror -g -ggdb -std=gnu99 -coverage LDFLAGS = -coverage -lm LDLIBS = -lcheck diff --git a/deps/bitfield-c b/deps/bitfield-c -Subproject eab0c42eac865a7e965878a7f2ad548371bd34d +Subproject 7f1d5473842361f97fef886bc4e98949ecf853b diff --git a/tests/common.c b/tests/common.c index f9898b32..d062db5d 100644 --- a/tests/common.c +++ b/tests/common.c @@ -3,6 +3,7 @@ #include <stdio.h> #include <stdlib.h> #include <stdarg.h> +#include <string.h> IsoTpShims SHIMS; IsoTpReceiveHandle RECEIVE_HANDLE; @@ -30,7 +31,7 @@ void debug(const char* format, ...) { va_end(args); } -void mock_send_can(const uint16_t arbitration_id, const uint8_t* data, +bool mock_send_can(const uint16_t arbitration_id, const uint8_t* data, const uint8_t size) { can_frame_was_sent = true; last_can_frame_sent_arb_id = arbitration_id; @@ -38,9 +39,7 @@ void mock_send_can(const uint16_t arbitration_id, const uint8_t* data, if(size > 0) { memcpy(last_can_payload_sent, data, size); } -} - -void mock_set_timer(uint16_t time_ms, void (*callback)) { + return true; } void message_received(const IsoTpMessage* message) { @@ -80,7 +79,7 @@ void can_frame_sent(const uint16_t arbitration_id, const uint8_t* payload, } void setup() { - SHIMS = isotp_init_shims(debug, mock_send_can, mock_set_timer); + SHIMS = isotp_init_shims(debug, mock_send_can, NULL); RECEIVE_HANDLE = isotp_receive(&SHIMS, 0x2a, message_received); memset(last_message_sent_payload, 0, OUR_MAX_ISO_TP_MESSAGE_SIZE); memset(last_message_received_payload, 0, OUR_MAX_ISO_TP_MESSAGE_SIZE); diff --git a/tests/test_send.c b/tests/test_send.c index 7944e6ff..fecb2596 100644 --- a/tests/test_send.c +++ b/tests/test_send.c @@ -48,8 +48,7 @@ START_TEST (test_send_single_frame) { const uint8_t payload[] = {0x12, 0x34}; uint16_t arbitration_id = 0x2a; - IsoTpSendHandle handle = isotp_send(&SHIMS, arbitration_id, payload, - sizeof(payload), message_sent); + isotp_send(&SHIMS, arbitration_id, payload, sizeof(payload), message_sent); ck_assert_int_eq(last_message_sent_arb_id, arbitration_id); fail_unless(last_message_sent_status); ck_assert_int_eq(last_message_sent_payload[0], 0x12); |