diff options
Diffstat (limited to 'tests')
-rw-r--r-- | tests/common.c | 8 | ||||
-rw-r--r-- | tests/test_receive.c | 4 | ||||
-rw-r--r-- | tests/test_send.c | 8 |
3 files changed, 10 insertions, 10 deletions
diff --git a/tests/common.c b/tests/common.c index 247d8f3d..882c266a 100644 --- a/tests/common.c +++ b/tests/common.c @@ -14,12 +14,12 @@ bool can_frame_was_sent; bool message_was_received; uint16_t last_message_received_arb_id; -uint8_t* last_message_received_payload; +uint8_t last_message_received_payload[OUR_MAX_ISO_TP_MESSAGE_SIZE]; uint8_t last_message_received_payload_size; uint16_t last_message_sent_arb_id; bool last_message_sent_status; -uint8_t* last_message_sent_payload; +uint8_t last_message_sent_payload[OUR_MAX_ISO_TP_MESSAGE_SIZE]; uint8_t last_message_sent_payload_size; void debug(const char* format, ...) { @@ -84,8 +84,8 @@ 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); HANDLE = isotp_receive(&SHIMS, 0x2a, message_received); - last_message_sent_payload = malloc(MAX_ISO_TP_MESSAGE_SIZE); - last_message_received_payload = malloc(MAX_ISO_TP_MESSAGE_SIZE); + memset(last_message_sent_payload, 0, OUR_MAX_ISO_TP_MESSAGE_SIZE); + memset(last_message_received_payload, 0, OUR_MAX_ISO_TP_MESSAGE_SIZE); memset(last_can_payload_sent, 0, sizeof(last_can_payload_sent)); last_message_sent_status = false; message_was_received = false; diff --git a/tests/test_receive.c b/tests/test_receive.c index 5c757076..d8c2392e 100644 --- a/tests/test_receive.c +++ b/tests/test_receive.c @@ -15,12 +15,12 @@ extern bool can_frame_was_sent; extern bool message_was_received; extern uint16_t last_message_received_arb_id; -extern uint8_t* last_message_received_payload; +extern uint8_t last_message_received_payload[]; extern uint8_t last_message_received_payload_size; extern uint16_t last_message_sent_arb_id; extern bool last_message_sent_status; -extern uint8_t* last_message_sent_payload; +extern uint8_t last_message_sent_payload[]; extern uint8_t last_message_sent_payload_size; extern void setup(); diff --git a/tests/test_send.c b/tests/test_send.c index 0320576c..ca1842a6 100644 --- a/tests/test_send.c +++ b/tests/test_send.c @@ -17,12 +17,12 @@ extern bool can_frame_was_sent; extern bool message_was_received; extern uint16_t last_message_received_arb_id; -extern uint8_t* last_message_received_payload; +extern uint8_t last_message_received_payload[]; extern uint8_t last_message_received_payload_size; extern uint16_t last_message_sent_arb_id; extern bool last_message_sent_status; -extern uint8_t* last_message_sent_payload; +extern uint8_t last_message_sent_payload[]; extern uint8_t last_message_sent_payload_size; extern void setup(); @@ -49,8 +49,8 @@ START_TEST (test_send_single_frame) { const uint8_t payload[] = {0x12, 0x34}; uint16_t arbitration_id = 0x2a; - IsoTpHandle handle = isotp_send(&SHIMS, arbitration_id, payload, sizeof(payload), - message_sent); + IsoTpHandle handle = 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); |