aboutsummaryrefslogtreecommitdiff
path: root/fw
diff options
context:
space:
mode:
authorjaseg <git@jaseg.net>2019-01-12 22:47:05 +0900
committerjaseg <git@jaseg.net>2019-01-12 22:47:05 +0900
commit6006b360d1211283165d684ea9b09a5ea63510a7 (patch)
tree8b23de525bfee1013a62db2547d61641d7ad4b77 /fw
parent7461b22bfa50f5ec69be281ac35fb8c5b726ed8f (diff)
download8seg-6006b360d1211283165d684ea9b09a5ea63510a7.tar.gz
8seg-6006b360d1211283165d684ea9b09a5ea63510a7.tar.bz2
8seg-6006b360d1211283165d684ea9b09a5ea63510a7.zip
Make protocol unit tester count test cases
Diffstat (limited to 'fw')
-rw-r--r--fw/protocol_test.c7
1 files changed, 6 insertions, 1 deletions
diff --git a/fw/protocol_test.c b/fw/protocol_test.c
index ab824f2..d417a1b 100644
--- a/fw/protocol_test.c
+++ b/fw/protocol_test.c
@@ -10,7 +10,8 @@
#include "protocol.h"
#include "8b10b.h"
-int urandom_fd = -1;
+static int urandom_fd = -1;
+static long long n_tests = 0;
struct test_cmd_if {
struct command_if_def cmd_if;
@@ -32,6 +33,7 @@ void handle_command(int command, uint8_t *args) {
}
void send_test_command_single(struct test_cmd_if *cmd_if, struct proto_rx_st *st, int cmd, int address, unsigned char pattern[256]) {
+ n_tests++;
receive_symbol(st, -K28_1);
receive_symbol(st, cmd);
receive_symbol(st, address);
@@ -40,6 +42,7 @@ void send_test_command_single(struct test_cmd_if *cmd_if, struct proto_rx_st *st
}
void send_test_command_bulk(struct test_cmd_if *cmd_if, struct proto_rx_st *st, int cmd, int index, int len, unsigned char pattern[256]) {
+ n_tests++;
receive_symbol(st, -K28_1);
receive_symbol(st, cmd | PKT_TYPE_BULK_FLAG);
for (int j=0; j<len; j++) {
@@ -154,4 +157,6 @@ int main(void) {
}
assert(!close(urandom_fd));
+
+ printf("Successfully ran %lld tests\n", n_tests);
}