aboutsummaryrefslogtreecommitdiff
path: root/src/test/test_util.c
diff options
context:
space:
mode:
authorNick Mathewson <nickm@torproject.org>2012-03-08 21:00:57 -0500
committerNick Mathewson <nickm@torproject.org>2012-03-08 21:16:46 -0500
commit97b15e6fb0a1cda39adfadfe9f9926b6cf35b136 (patch)
treed3e0859ca48af278572ba51ce98d4515ee89987b /src/test/test_util.c
parent998891e7342155f7c0c5839f4c5816ace686134f (diff)
downloadtor-97b15e6fb0a1cda39adfadfe9f9926b6cf35b136.tar
tor-97b15e6fb0a1cda39adfadfe9f9926b6cf35b136.tar.gz
Fix new strcmp_opt/len tests on OSs where strcmp() can return values >1 or <-1
Diffstat (limited to 'src/test/test_util.c')
-rw-r--r--src/test/test_util.c30
1 files changed, 15 insertions, 15 deletions
diff --git a/src/test/test_util.c b/src/test/test_util.c
index 741b8d539..5bbf448ad 100644
--- a/src/test/test_util.c
+++ b/src/test/test_util.c
@@ -976,25 +976,25 @@ test_util_strmisc(void)
}
/* Test strcmp_opt */
- test_eq(-1, strcmp_opt("", "foo"));
- test_eq(0, strcmp_opt("", ""));
- test_eq(1, strcmp_opt("foo", ""));
+ tt_int_op(strcmp_opt("", "foo"), <, 0);
+ tt_int_op(strcmp_opt("", ""), ==, 0);
+ tt_int_op(strcmp_opt("foo", ""), >, 0);
- test_eq(-1, strcmp_opt(NULL, ""));
- test_eq(0, strcmp_opt(NULL, NULL));
- test_eq(1, strcmp_opt("", NULL));
+ tt_int_op(strcmp_opt(NULL, ""), <, 0);
+ tt_int_op(strcmp_opt(NULL, NULL), ==, 0);
+ tt_int_op(strcmp_opt("", NULL), >, 0);
- test_eq(-1, strcmp_opt(NULL, "foo"));
- test_eq(1, strcmp_opt("foo", NULL));
+ tt_int_op(strcmp_opt(NULL, "foo"), <, 0);
+ tt_int_op(strcmp_opt("foo", NULL), >, 0);
/* Test strcmp_len */
- test_eq(1, strcmp_len("foo", "bar", 3));
- test_eq(-1, strcmp_len("foo", "bar", 2)); /* First len, then lexical */
- test_eq(1, strcmp_len("foo2", "foo1", 4));
- test_eq(-1, strcmp_len("foo2", "foo1", 3)); /* Really stop at len */
- test_eq(0, strcmp_len("foo2", "foo", 3)); /* Really stop at len */
- test_eq(1, strcmp_len("blah", "", 4));
- test_eq(0, strcmp_len("blah", "", 0));
+ tt_int_op(strcmp_len("foo", "bar", 3), >, 0);
+ tt_int_op(strcmp_len("foo", "bar", 2), <, 0); /* First len, then lexical */
+ tt_int_op(strcmp_len("foo2", "foo1", 4), >, 0);
+ tt_int_op(strcmp_len("foo2", "foo1", 3), <, 0); /* Really stop at len */
+ tt_int_op(strcmp_len("foo2", "foo", 3), ==, 0); /* Really stop at len */
+ tt_int_op(strcmp_len("blah", "", 4), >, 0);
+ tt_int_op(strcmp_len("blah", "", 0), ==, 0);
done:
;