aboutsummaryrefslogtreecommitdiffstats
path: root/tests/test_core.c
diff options
context:
space:
mode:
authorChristopher Peplin <chris.peplin@rhubarbtech.com>2014-01-02 15:28:06 -0500
committerChristopher Peplin <chris.peplin@rhubarbtech.com>2014-01-02 15:29:05 -0500
commit54713fc5deab5de318d79035a0927d828ae239f5 (patch)
tree98260216adf7b4a27422c921f9f2a0c7b53225ef /tests/test_core.c
parent7a5e3a7037170aacc3f3438f1267c635358d91a8 (diff)
Draft implemenation of receiving and parsing single fram diag messages.
Diffstat (limited to 'tests/test_core.c')
-rw-r--r--tests/test_core.c10
1 files changed, 6 insertions, 4 deletions
diff --git a/tests/test_core.c b/tests/test_core.c
index a466e8e0..2730cd73 100644
--- a/tests/test_core.c
+++ b/tests/test_core.c
@@ -8,7 +8,12 @@ extern void setup();
extern bool last_response_was_received;
extern DiagnosticResponse last_response_received;
extern DiagnosticShims SHIMS;
-extern DiagnosticResponseReceived response_received_handler;
+
+void response_received_handler(const DiagnosticResponse* response) {
+ last_response_was_received = true;
+ // TODO not sure if we can copy the struct like this
+ last_response_received = *response;
+}
START_TEST (test_receive_wrong_arb_id)
{
@@ -45,11 +50,9 @@ START_TEST (test_send_diag_request)
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,
request.arbitration_id + 0x8);
- // TODO should we set it back to the original mode, or leave as mode + 0x40?
ck_assert_int_eq(last_response_received.mode, request.mode);
ck_assert_int_eq(last_response_received.pid, 0);
ck_assert_int_eq(last_response_received.payload_length, 1);
@@ -71,7 +74,6 @@ START_TEST (test_request_pid_standard)
ck_assert(last_response_received.success);
ck_assert_int_eq(last_response_received.arbitration_id,
0x7df + 0x8);
- // TODO should we set it back to the original mode, or leave as mode + 0x40?
ck_assert_int_eq(last_response_received.mode, 0x1);
ck_assert_int_eq(last_response_received.pid, 0x2);
ck_assert_int_eq(last_response_received.payload_length, 1);