summaryrefslogtreecommitdiffstats
path: root/lib/tests/test_tcp.c
diff options
context:
space:
mode:
Diffstat (limited to 'lib/tests/test_tcp.c')
-rw-r--r--lib/tests/test_tcp.c20
1 files changed, 11 insertions, 9 deletions
diff --git a/lib/tests/test_tcp.c b/lib/tests/test_tcp.c
index 8e9d43c..ae6dc1f 100644
--- a/lib/tests/test_tcp.c
+++ b/lib/tests/test_tcp.c
@@ -25,7 +25,7 @@ main (int argc, char **argv)
25{ 25{
26 char** server_expect; 26 char** server_expect;
27 int server_expect_count = 3; 27 int server_expect_count = 3;
28 plan_tests(8); 28 plan_tests(9);
29 29
30 server_expect = malloc(sizeof(char*) * server_expect_count); 30 server_expect = malloc(sizeof(char*) * server_expect_count);
31 31
@@ -33,21 +33,23 @@ main (int argc, char **argv)
33 server_expect[1] = strdup("bb"); 33 server_expect[1] = strdup("bb");
34 server_expect[2] = strdup("CC"); 34 server_expect[2] = strdup("CC");
35 35
36 ok(np_expect_match("AA bb CC XX", server_expect, server_expect_count, NP_MATCH_EXACT) == TRUE, 36 ok(np_expect_match("AA bb CC XX", server_expect, server_expect_count, NP_MATCH_EXACT) == NP_MATCH_SUCCESS,
37 "Test matching any string at the beginning (first expect string)"); 37 "Test matching any string at the beginning (first expect string)");
38 ok(np_expect_match("bb AA CC XX", server_expect, server_expect_count, NP_MATCH_EXACT) == TRUE, 38 ok(np_expect_match("bb AA CC XX", server_expect, server_expect_count, NP_MATCH_EXACT) == NP_MATCH_SUCCESS,
39 "Test matching any string at the beginning (second expect string)"); 39 "Test matching any string at the beginning (second expect string)");
40 ok(np_expect_match("XX bb AA CC XX", server_expect, server_expect_count, NP_MATCH_EXACT) == FALSE, 40 ok(np_expect_match("b", server_expect, server_expect_count, NP_MATCH_EXACT) == NP_MATCH_RETRY,
41 "Test matching any string at the beginning (substring match)");
42 ok(np_expect_match("XX bb AA CC XX", server_expect, server_expect_count, NP_MATCH_EXACT) == NP_MATCH_FAILURE,
41 "Test with strings not matching at the beginning"); 43 "Test with strings not matching at the beginning");
42 ok(np_expect_match("XX CC XX", server_expect, server_expect_count, NP_MATCH_EXACT) == FALSE, 44 ok(np_expect_match("XX CC XX", server_expect, server_expect_count, NP_MATCH_EXACT) == NP_MATCH_FAILURE,
43 "Test matching any string"); 45 "Test matching any string");
44 ok(np_expect_match("XX", server_expect, server_expect_count, 0) == FALSE, 46 ok(np_expect_match("XX", server_expect, server_expect_count, 0) == NP_MATCH_RETRY,
45 "Test not matching any string"); 47 "Test not matching any string");
46 ok(np_expect_match("XX AA bb CC XX", server_expect, server_expect_count, NP_MATCH_ALL) == TRUE, 48 ok(np_expect_match("XX AA bb CC XX", server_expect, server_expect_count, NP_MATCH_ALL) == NP_MATCH_SUCCESS,
47 "Test matching all strings"); 49 "Test matching all strings");
48 ok(np_expect_match("XX bb CC XX", server_expect, server_expect_count, NP_MATCH_ALL) == FALSE, 50 ok(np_expect_match("XX bb CC XX", server_expect, server_expect_count, NP_MATCH_ALL) == NP_MATCH_RETRY,
49 "Test not matching all strings"); 51 "Test not matching all strings");
50 ok(np_expect_match("XX XX", server_expect, server_expect_count, NP_MATCH_ALL) == FALSE, 52 ok(np_expect_match("XX XX", server_expect, server_expect_count, NP_MATCH_ALL) == NP_MATCH_RETRY,
51 "Test not matching any string (testing all)"); 53 "Test not matching any string (testing all)");
52 54
53 55