diff options
author | Christopher Peplin <chris.peplin@rhubarbtech.com> | 2013-12-27 23:06:23 -0500 |
---|---|---|
committer | Christopher Peplin <chris.peplin@rhubarbtech.com> | 2013-12-27 23:06:23 -0500 |
commit | 37a7e905f653eeb7d923eedaa9f30cdb9fd6de78 (patch) | |
tree | 6d8ad57dbc2a00084e1a54e929983edcad443a6b /tests/test_send.c | |
parent | 9fadf3909846796d3666c5b8f9cbec9fc4e979c4 (diff) |
Test basic single frame sending.
Diffstat (limited to 'tests/test_send.c')
-rw-r--r-- | tests/test_send.c | 24 |
1 files changed, 22 insertions, 2 deletions
diff --git a/tests/test_send.c b/tests/test_send.c index 144e040f..c2293c21 100644 --- a/tests/test_send.c +++ b/tests/test_send.c @@ -25,15 +25,34 @@ extern uint8_t last_message_sent_payload_size; extern void setup(); +START_TEST (test_send_empty_payload) +{ + fail_unless(isotp_send(&ISOTP_HANDLER, NULL, 0)); + ck_assert_int_eq(last_message_sent_arb_id, ISOTP_HANDLER.arbitration_id); + fail_unless(last_message_sent_status); + ck_assert_int_eq(last_message_sent_payload[0], NULL); + ck_assert_int_eq(last_message_sent_payload_size, 0); +} +END_TEST + START_TEST (test_send_single_frame) { - fail_if(true); + const uint8_t payload[] = {0x12, 0x34}; + fail_unless(isotp_send(&ISOTP_HANDLER, &payload, sizeof(payload))); + ck_assert_int_eq(last_message_sent_arb_id, ISOTP_HANDLER.arbitration_id); + fail_unless(last_message_sent_status); + ck_assert_int_eq(last_message_sent_payload[0], 0x12); + ck_assert_int_eq(last_message_sent_payload[1], 0x34); + ck_assert_int_eq(last_message_sent_payload_size, 2); } END_TEST START_TEST (test_send_multi_frame) { - fail_if(true); + const uint8_t payload[] = {0x12, 0x34, 0x56, 0x78, 0x90, 0x01, 0x23, + 0x45, 0x67, 0x89}; + bool status = isotp_send(&ISOTP_HANDLER, &payload, sizeof(payload)); + fail_if(status); } END_TEST @@ -41,6 +60,7 @@ Suite* testSuite(void) { Suite* s = suite_create("iso15765"); TCase *tc_core = tcase_create("send"); tcase_add_checked_fixture(tc_core, setup, NULL); + tcase_add_test(tc_core, test_send_empty_payload); tcase_add_test(tc_core, test_send_single_frame); tcase_add_test(tc_core, test_send_multi_frame); suite_add_tcase(s, tc_core); |