+START_TEST (test_autoset_pid_length)
+{
+ uint16_t arb_id = OBD2_MODE_POWERTRAIN_DIAGNOSTIC_REQUEST;
+ diagnostic_request_pid(&SHIMS, DIAGNOSTIC_STANDARD_PID, arb_id, 0x2,
+ response_received_handler);
+
+ ck_assert_int_eq(last_can_frame_sent_arb_id, arb_id);
+ ck_assert_int_eq(last_can_payload_sent[1], 0x1);
+ ck_assert_int_eq(last_can_payload_sent[2], 0x2);
+ ck_assert_int_eq(last_can_payload_size, 3);
+
+ DiagnosticRequest request = {
+ arbitration_id: 0x100,
+ mode: 0x22,
+ has_pid: true,
+ pid: 2
+ };
+ diagnostic_request(&SHIMS, &request, response_received_handler);
+
+ ck_assert_int_eq(last_can_frame_sent_arb_id, request.arbitration_id);
+ ck_assert_int_eq(last_can_payload_sent[1], request.mode);
+ck_assert_int_eq(last_can_payload_size, 4);
+}
+END_TEST
+