summaryrefslogtreecommitdiffstats
path: root/tests/test_send.c
diff options
context:
space:
mode:
authorChristopher Peplin <chris.peplin@rhubarbtech.com>2013-12-27 18:28:03 -0500
committerChristopher Peplin <chris.peplin@rhubarbtech.com>2013-12-27 18:28:53 -0500
commit34a7c0ca08683eb83d6b6b3d5a6a8fb2f7d5b918 (patch)
tree1efa4c1b7c206e06817ea3bd6e171647c67b3602 /tests/test_send.c
parent61344915dfdd01101d086b79b56109a9942cbf1a (diff)
Add skeleton tests for receiving and sending ISO-TP messages.
Diffstat (limited to 'tests/test_send.c')
-rw-r--r--tests/test_send.c61
1 files changed, 61 insertions, 0 deletions
diff --git a/tests/test_send.c b/tests/test_send.c
new file mode 100644
index 00000000..144e040f
--- /dev/null
+++ b/tests/test_send.c
@@ -0,0 +1,61 @@
+#include <isotp/isotp.h>
+#include <check.h>
+#include <stdint.h>
+#include <stdio.h>
+#include <stdlib.h>
+#include <stdarg.h>
+
+extern IsoTpShims SHIMS;
+extern IsoTpHandler ISOTP_HANDLER;
+
+extern uint16_t last_can_frame_sent_arb_id;
+extern uint8_t last_can_payload_sent;
+extern uint8_t last_can_payload_size;
+extern bool can_frame_was_sent;
+
+extern bool message_was_received;
+extern uint16_t last_message_received_arb_id;
+extern uint8_t* last_message_received_payload;
+extern uint8_t last_message_received_payload_size;
+
+extern uint16_t last_message_sent_arb_id;
+extern bool last_message_sent_status;
+extern uint8_t* last_message_sent_payload;
+extern uint8_t last_message_sent_payload_size;
+
+extern void setup();
+
+START_TEST (test_send_single_frame)
+{
+ fail_if(true);
+}
+END_TEST
+
+START_TEST (test_send_multi_frame)
+{
+ fail_if(true);
+}
+END_TEST
+
+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_single_frame);
+ tcase_add_test(tc_core, test_send_multi_frame);
+ suite_add_tcase(s, tc_core);
+
+ return s;
+}
+
+int main(void) {
+ int numberFailed;
+ Suite* s = testSuite();
+ SRunner *sr = srunner_create(s);
+ // Don't fork so we can actually use gdb
+ srunner_set_fork_status(sr, CK_NOFORK);
+ srunner_run_all(sr, CK_NORMAL);
+ numberFailed = srunner_ntests_failed(sr);
+ srunner_free(sr);
+ return (numberFailed == 0) ? 0 : 1;
+}