diff options
author | Christopher Peplin <chris.peplin@rhubarbtech.com> | 2014-01-02 12:00:52 -0500 |
---|---|---|
committer | Christopher Peplin <chris.peplin@rhubarbtech.com> | 2014-01-02 12:10:48 -0500 |
commit | 7a5e3a7037170aacc3f3438f1267c635358d91a8 (patch) | |
tree | 8fd8dd29fb7a45962982ce4a41b7fb0ec6af1927 /tests/test_core.c | |
parent | 1d6ab7e3c86cfd018977cab89a0dd32762984d58 (diff) |
Match isotp receive_can_frame style, depend less on callbacks.
Diffstat (limited to 'tests/test_core.c')
-rw-r--r-- | tests/test_core.c | 17 |
1 files changed, 11 insertions, 6 deletions
diff --git a/tests/test_core.c b/tests/test_core.c index 340a326..a466e8e 100644 --- a/tests/test_core.c +++ b/tests/test_core.c @@ -21,8 +21,8 @@ START_TEST (test_receive_wrong_arb_id) fail_if(last_response_was_received); const uint8_t can_data[] = {0x2, request.mode + 0x40, 0x23}; - diagnostic_receive_can_frame(&handle, request.arbitration_id, can_data, - sizeof(can_data)); + diagnostic_receive_can_frame(&SHIMS, &handle, request.arbitration_id, + can_data, sizeof(can_data)); fail_if(last_response_was_received); } END_TEST @@ -36,10 +36,15 @@ START_TEST (test_send_diag_request) DiagnosticRequestHandle handle = diagnostic_request(&SHIMS, &request, response_received_handler); + fail_if(handle.completed); + fail_if(last_response_was_received); const uint8_t can_data[] = {0x2, request.mode + 0x40, 0x23}; - diagnostic_receive_can_frame(&handle, request.arbitration_id + 0x8, - can_data, sizeof(can_data)); + DiagnosticResponse response = diagnostic_receive_can_frame(&SHIMS, &handle, + request.arbitration_id + 0x8, can_data, sizeof(can_data)); + fail_unless(response.success); + fail_unless(response.completed); + fail_unless(handle.completed); fail_unless(last_response_was_received); ck_assert(last_response_received.success); ck_assert_int_eq(last_response_received.arbitration_id, @@ -60,7 +65,7 @@ START_TEST (test_request_pid_standard) fail_if(last_response_was_received); const uint8_t can_data[] = {0x3, 0x1 + 0x40, 0x2, 0x45}; // TODO need a constant for the 7df broadcast functional request - diagnostic_receive_can_frame(&handle, 0x7df + 0x8, + diagnostic_receive_can_frame(&SHIMS, &handle, 0x7df + 0x8, can_data, sizeof(can_data)); fail_unless(last_response_was_received); ck_assert(last_response_received.success); @@ -82,7 +87,7 @@ START_TEST (test_request_pid_enhanced) fail_if(last_response_was_received); const uint8_t can_data[] = {0x4, 0x1 + 0x40, 0x0, 0x2, 0x45}; // TODO need a constant for the 7df broadcast functional request - diagnostic_receive_can_frame(&handle, 0x7df + 0x8, can_data, + diagnostic_receive_can_frame(&SHIMS, &handle, 0x7df + 0x8, can_data, sizeof(can_data)); fail_unless(last_response_was_received); ck_assert(last_response_received.success); |