diff options
author | Christopher Peplin <chris.peplin@rhubarbtech.com> | 2014-01-07 17:12:05 -0500 |
---|---|---|
committer | Christopher Peplin <chris.peplin@rhubarbtech.com> | 2014-01-07 17:20:15 -0500 |
commit | 352be104317c7c7867046f9eb48f923282b0d45e (patch) | |
tree | 861cc174d12b6f0222a2ffc353cba27dcefc9039 /tests | |
parent | 1525ed0325c7679d4ea42724652119aceb5a4d13 (diff) |
Don't complete requests if mode or PID didn't match.
Diffstat (limited to 'tests')
-rw-r--r-- | tests/test_core.c | 23 |
1 files changed, 18 insertions, 5 deletions
diff --git a/tests/test_core.c b/tests/test_core.c index b115c1c8..8615ff12 100644 --- a/tests/test_core.c +++ b/tests/test_core.c @@ -139,11 +139,23 @@ START_TEST (test_wrong_mode_response) const uint8_t can_data[] = {0x4, 0x1 + 0x40, 0x0, 0x2, 0x45}; diagnostic_receive_can_frame(&SHIMS, &handle, arb_id + 0x8, can_data, sizeof(can_data)); - // TODO change this if we even re-request a message receipt on a mode or PID - // mismatch - fail_unless(last_response_was_received); - fail_unless(handle.completed); - fail_if(last_response_received.success); + fail_if(last_response_was_received); + fail_if(handle.completed); +} +END_TEST + +START_TEST (test_wrong_pid_response) +{ + uint16_t arb_id = OBD2_FUNCTIONAL_BROADCAST_ID; + DiagnosticRequestHandle handle = diagnostic_request_pid(&SHIMS, + DIAGNOSTIC_ENHANCED_PID, arb_id, 0x2, response_received_handler); + + fail_if(last_response_was_received); + const uint8_t can_data[] = {0x4, 0x22 + 0x40, 0x0, 0x3, 0x45}; + diagnostic_receive_can_frame(&SHIMS, &handle, arb_id + 0x8, can_data, + sizeof(can_data)); + fail_if(last_response_was_received); + fail_if(handle.completed); } END_TEST @@ -216,6 +228,7 @@ Suite* testSuite(void) { tcase_add_test(tc_core, test_request_pid_standard); tcase_add_test(tc_core, test_request_pid_enhanced); tcase_add_test(tc_core, test_wrong_mode_response); + tcase_add_test(tc_core, test_wrong_pid_response); tcase_add_test(tc_core, test_handle_completed); tcase_add_test(tc_core, test_negative_response); |