diff options
Diffstat (limited to 'regress/unittests')
-rw-r--r-- | regress/unittests/Makefile | 7 | ||||
-rw-r--r-- | regress/unittests/conversion/Makefile | 10 | ||||
-rw-r--r-- | regress/unittests/conversion/tests.c | 51 | ||||
-rw-r--r-- | regress/unittests/match/tests.c | 21 | ||||
-rw-r--r-- | regress/unittests/test_helper/test_helper.c | 13 | ||||
-rw-r--r-- | regress/unittests/test_helper/test_helper.h | 17 | ||||
-rw-r--r-- | regress/unittests/utf8/tests.c | 65 |
7 files changed, 155 insertions, 29 deletions
diff --git a/regress/unittests/Makefile b/regress/unittests/Makefile index e70b16644..e975f6ca4 100644 --- a/regress/unittests/Makefile +++ b/regress/unittests/Makefile | |||
@@ -1,5 +1,6 @@ | |||
1 | # $OpenBSD: Makefile,v 1.7 2016/08/19 06:44:13 djm Exp $ | 1 | # $OpenBSD: Makefile,v 1.9 2017/03/14 01:20:29 dtucker Exp $ |
2 | REGRESS_FAIL_EARLY= yes | 2 | |
3 | SUBDIR= test_helper sshbuf sshkey bitmap kex hostkeys utf8 match | 3 | REGRESS_FAIL_EARLY?= yes |
4 | SUBDIR= test_helper sshbuf sshkey bitmap kex hostkeys utf8 match conversion | ||
4 | 5 | ||
5 | .include <bsd.subdir.mk> | 6 | .include <bsd.subdir.mk> |
diff --git a/regress/unittests/conversion/Makefile b/regress/unittests/conversion/Makefile new file mode 100644 index 000000000..cde97dc28 --- /dev/null +++ b/regress/unittests/conversion/Makefile | |||
@@ -0,0 +1,10 @@ | |||
1 | # $OpenBSD: Makefile,v 1.1 2017/03/14 01:20:29 dtucker Exp $ | ||
2 | |||
3 | PROG=test_conversion | ||
4 | SRCS=tests.c | ||
5 | REGRESS_TARGETS=run-regress-${PROG} | ||
6 | |||
7 | run-regress-${PROG}: ${PROG} | ||
8 | env ${TEST_ENV} ./${PROG} | ||
9 | |||
10 | .include <bsd.regress.mk> | ||
diff --git a/regress/unittests/conversion/tests.c b/regress/unittests/conversion/tests.c new file mode 100644 index 000000000..6dd77ef42 --- /dev/null +++ b/regress/unittests/conversion/tests.c | |||
@@ -0,0 +1,51 @@ | |||
1 | /* $OpenBSD: tests.c,v 1.1 2017/03/14 01:20:29 dtucker Exp $ */ | ||
2 | /* | ||
3 | * Regress test for conversions | ||
4 | * | ||
5 | * Placed in the public domain | ||
6 | */ | ||
7 | |||
8 | #include "includes.h" | ||
9 | |||
10 | #include <sys/types.h> | ||
11 | #include <sys/param.h> | ||
12 | #include <stdio.h> | ||
13 | #ifdef HAVE_STDINT_H | ||
14 | #include <stdint.h> | ||
15 | #endif | ||
16 | #include <stdlib.h> | ||
17 | #include <string.h> | ||
18 | |||
19 | #include "../test_helper/test_helper.h" | ||
20 | |||
21 | #include "misc.h" | ||
22 | |||
23 | void | ||
24 | tests(void) | ||
25 | { | ||
26 | char buf[1024]; | ||
27 | |||
28 | TEST_START("conversion_convtime"); | ||
29 | ASSERT_LONG_EQ(convtime("0"), 0); | ||
30 | ASSERT_LONG_EQ(convtime("1"), 1); | ||
31 | ASSERT_LONG_EQ(convtime("1S"), 1); | ||
32 | /* from the examples in the comment above the function */ | ||
33 | ASSERT_LONG_EQ(convtime("90m"), 5400); | ||
34 | ASSERT_LONG_EQ(convtime("1h30m"), 5400); | ||
35 | ASSERT_LONG_EQ(convtime("2d"), 172800); | ||
36 | ASSERT_LONG_EQ(convtime("1w"), 604800); | ||
37 | |||
38 | /* negative time is not allowed */ | ||
39 | ASSERT_LONG_EQ(convtime("-7"), -1); | ||
40 | ASSERT_LONG_EQ(convtime("-9d"), -1); | ||
41 | |||
42 | /* overflow */ | ||
43 | snprintf(buf, sizeof buf, "%llu", (unsigned long long)LONG_MAX + 1); | ||
44 | ASSERT_LONG_EQ(convtime(buf), -1); | ||
45 | |||
46 | /* overflow with multiplier */ | ||
47 | snprintf(buf, sizeof buf, "%lluM", (unsigned long long)LONG_MAX/60 + 1); | ||
48 | ASSERT_LONG_EQ(convtime(buf), -1); | ||
49 | ASSERT_LONG_EQ(convtime("1000000000000000000000w"), -1); | ||
50 | TEST_DONE(); | ||
51 | } | ||
diff --git a/regress/unittests/match/tests.c b/regress/unittests/match/tests.c index 7ff319c16..e1593367b 100644 --- a/regress/unittests/match/tests.c +++ b/regress/unittests/match/tests.c | |||
@@ -1,4 +1,4 @@ | |||
1 | /* $OpenBSD: tests.c,v 1.3 2016/09/21 17:03:54 djm Exp $ */ | 1 | /* $OpenBSD: tests.c,v 1.4 2017/02/03 23:01:42 djm Exp $ */ |
2 | /* | 2 | /* |
3 | * Regress test for matching functions | 3 | * Regress test for matching functions |
4 | * | 4 | * |
@@ -103,6 +103,25 @@ tests(void) | |||
103 | /* XXX negated ASSERT_INT_EQ(addr_match_list("127.0.0.1", "!127.0.0.2,10.0.0.1"), 1); */ | 103 | /* XXX negated ASSERT_INT_EQ(addr_match_list("127.0.0.1", "!127.0.0.2,10.0.0.1"), 1); */ |
104 | TEST_DONE(); | 104 | TEST_DONE(); |
105 | 105 | ||
106 | #define CHECK_FILTER(string,filter,expected) \ | ||
107 | do { \ | ||
108 | char *result = match_filter_list((string), (filter)); \ | ||
109 | ASSERT_STRING_EQ(result, expected); \ | ||
110 | free(result); \ | ||
111 | } while (0) | ||
112 | |||
113 | TEST_START("match_filter_list"); | ||
114 | CHECK_FILTER("a,b,c", "", "a,b,c"); | ||
115 | CHECK_FILTER("a,b,c", "a", "b,c"); | ||
116 | CHECK_FILTER("a,b,c", "b", "a,c"); | ||
117 | CHECK_FILTER("a,b,c", "c", "a,b"); | ||
118 | CHECK_FILTER("a,b,c", "a,b", "c"); | ||
119 | CHECK_FILTER("a,b,c", "a,c", "b"); | ||
120 | CHECK_FILTER("a,b,c", "b,c", "a"); | ||
121 | CHECK_FILTER("a,b,c", "a,b,c", ""); | ||
122 | CHECK_FILTER("a,b,c", "b,c", "a"); | ||
123 | CHECK_FILTER("", "a,b,c", ""); | ||
124 | TEST_DONE(); | ||
106 | /* | 125 | /* |
107 | * XXX TODO | 126 | * XXX TODO |
108 | * int match_host_and_ip(const char *, const char *, const char *); | 127 | * int match_host_and_ip(const char *, const char *, const char *); |
diff --git a/regress/unittests/test_helper/test_helper.c b/regress/unittests/test_helper/test_helper.c index 26ca26b5e..f855137fb 100644 --- a/regress/unittests/test_helper/test_helper.c +++ b/regress/unittests/test_helper/test_helper.c | |||
@@ -1,4 +1,4 @@ | |||
1 | /* $OpenBSD: test_helper.c,v 1.6 2015/03/03 20:42:49 djm Exp $ */ | 1 | /* $OpenBSD: test_helper.c,v 1.7 2017/03/14 01:10:07 dtucker Exp $ */ |
2 | /* | 2 | /* |
3 | * Copyright (c) 2011 Damien Miller <djm@mindrot.org> | 3 | * Copyright (c) 2011 Damien Miller <djm@mindrot.org> |
4 | * | 4 | * |
@@ -442,6 +442,17 @@ assert_u_int(const char *file, int line, const char *a1, const char *a2, | |||
442 | } | 442 | } |
443 | 443 | ||
444 | void | 444 | void |
445 | assert_long(const char *file, int line, const char *a1, const char *a2, | ||
446 | long aa1, long aa2, enum test_predicate pred) | ||
447 | { | ||
448 | TEST_CHECK(aa1, aa2, pred); | ||
449 | test_header(file, line, a1, a2, "LONG", pred); | ||
450 | fprintf(stderr, "%12s = %ld / 0x%lx\n", a1, aa1, aa1); | ||
451 | fprintf(stderr, "%12s = %ld / 0x%lx\n", a2, aa2, aa2); | ||
452 | test_die(); | ||
453 | } | ||
454 | |||
455 | void | ||
445 | assert_long_long(const char *file, int line, const char *a1, const char *a2, | 456 | assert_long_long(const char *file, int line, const char *a1, const char *a2, |
446 | long long aa1, long long aa2, enum test_predicate pred) | 457 | long long aa1, long long aa2, enum test_predicate pred) |
447 | { | 458 | { |
diff --git a/regress/unittests/test_helper/test_helper.h b/regress/unittests/test_helper/test_helper.h index 1d9c66986..615b7832b 100644 --- a/regress/unittests/test_helper/test_helper.h +++ b/regress/unittests/test_helper/test_helper.h | |||
@@ -1,4 +1,4 @@ | |||
1 | /* $OpenBSD: test_helper.h,v 1.6 2015/01/18 19:52:44 djm Exp $ */ | 1 | /* $OpenBSD: test_helper.h,v 1.7 2017/03/14 01:10:07 dtucker Exp $ */ |
2 | /* | 2 | /* |
3 | * Copyright (c) 2011 Damien Miller <djm@mindrot.org> | 3 | * Copyright (c) 2011 Damien Miller <djm@mindrot.org> |
4 | * | 4 | * |
@@ -67,6 +67,9 @@ void assert_size_t(const char *file, int line, | |||
67 | void assert_u_int(const char *file, int line, | 67 | void assert_u_int(const char *file, int line, |
68 | const char *a1, const char *a2, | 68 | const char *a1, const char *a2, |
69 | u_int aa1, u_int aa2, enum test_predicate pred); | 69 | u_int aa1, u_int aa2, enum test_predicate pred); |
70 | void assert_long(const char *file, int line, | ||
71 | const char *a1, const char *a2, | ||
72 | long aa1, long aa2, enum test_predicate pred); | ||
70 | void assert_long_long(const char *file, int line, | 73 | void assert_long_long(const char *file, int line, |
71 | const char *a1, const char *a2, | 74 | const char *a1, const char *a2, |
72 | long long aa1, long long aa2, enum test_predicate pred); | 75 | long long aa1, long long aa2, enum test_predicate pred); |
@@ -110,6 +113,8 @@ void assert_u64(const char *file, int line, | |||
110 | assert_size_t(__FILE__, __LINE__, #a1, #a2, a1, a2, TEST_EQ) | 113 | assert_size_t(__FILE__, __LINE__, #a1, #a2, a1, a2, TEST_EQ) |
111 | #define ASSERT_U_INT_EQ(a1, a2) \ | 114 | #define ASSERT_U_INT_EQ(a1, a2) \ |
112 | assert_u_int(__FILE__, __LINE__, #a1, #a2, a1, a2, TEST_EQ) | 115 | assert_u_int(__FILE__, __LINE__, #a1, #a2, a1, a2, TEST_EQ) |
116 | #define ASSERT_LONG_EQ(a1, a2) \ | ||
117 | assert_long(__FILE__, __LINE__, #a1, #a2, a1, a2, TEST_EQ) | ||
113 | #define ASSERT_LONG_LONG_EQ(a1, a2) \ | 118 | #define ASSERT_LONG_LONG_EQ(a1, a2) \ |
114 | assert_long_long(__FILE__, __LINE__, #a1, #a2, a1, a2, TEST_EQ) | 119 | assert_long_long(__FILE__, __LINE__, #a1, #a2, a1, a2, TEST_EQ) |
115 | #define ASSERT_CHAR_EQ(a1, a2) \ | 120 | #define ASSERT_CHAR_EQ(a1, a2) \ |
@@ -139,6 +144,8 @@ void assert_u64(const char *file, int line, | |||
139 | assert_size_t(__FILE__, __LINE__, #a1, #a2, a1, a2, TEST_NE) | 144 | assert_size_t(__FILE__, __LINE__, #a1, #a2, a1, a2, TEST_NE) |
140 | #define ASSERT_U_INT_NE(a1, a2) \ | 145 | #define ASSERT_U_INT_NE(a1, a2) \ |
141 | assert_u_int(__FILE__, __LINE__, #a1, #a2, a1, a2, TEST_NE) | 146 | assert_u_int(__FILE__, __LINE__, #a1, #a2, a1, a2, TEST_NE) |
147 | #define ASSERT_LONG_NE(a1, a2) \ | ||
148 | assert_long(__FILE__, __LINE__, #a1, #a2, a1, a2, TEST_NE) | ||
142 | #define ASSERT_LONG_LONG_NE(a1, a2) \ | 149 | #define ASSERT_LONG_LONG_NE(a1, a2) \ |
143 | assert_long_long(__FILE__, __LINE__, #a1, #a2, a1, a2, TEST_NE) | 150 | assert_long_long(__FILE__, __LINE__, #a1, #a2, a1, a2, TEST_NE) |
144 | #define ASSERT_CHAR_NE(a1, a2) \ | 151 | #define ASSERT_CHAR_NE(a1, a2) \ |
@@ -166,6 +173,8 @@ void assert_u64(const char *file, int line, | |||
166 | assert_size_t(__FILE__, __LINE__, #a1, #a2, a1, a2, TEST_LT) | 173 | assert_size_t(__FILE__, __LINE__, #a1, #a2, a1, a2, TEST_LT) |
167 | #define ASSERT_U_INT_LT(a1, a2) \ | 174 | #define ASSERT_U_INT_LT(a1, a2) \ |
168 | assert_u_int(__FILE__, __LINE__, #a1, #a2, a1, a2, TEST_LT) | 175 | assert_u_int(__FILE__, __LINE__, #a1, #a2, a1, a2, TEST_LT) |
176 | #define ASSERT_LONG_LT(a1, a2) \ | ||
177 | assert_long(__FILE__, __LINE__, #a1, #a2, a1, a2, TEST_LT) | ||
169 | #define ASSERT_LONG_LONG_LT(a1, a2) \ | 178 | #define ASSERT_LONG_LONG_LT(a1, a2) \ |
170 | assert_long_long(__FILE__, __LINE__, #a1, #a2, a1, a2, TEST_LT) | 179 | assert_long_long(__FILE__, __LINE__, #a1, #a2, a1, a2, TEST_LT) |
171 | #define ASSERT_CHAR_LT(a1, a2) \ | 180 | #define ASSERT_CHAR_LT(a1, a2) \ |
@@ -193,6 +202,8 @@ void assert_u64(const char *file, int line, | |||
193 | assert_size_t(__FILE__, __LINE__, #a1, #a2, a1, a2, TEST_LE) | 202 | assert_size_t(__FILE__, __LINE__, #a1, #a2, a1, a2, TEST_LE) |
194 | #define ASSERT_U_INT_LE(a1, a2) \ | 203 | #define ASSERT_U_INT_LE(a1, a2) \ |
195 | assert_u_int(__FILE__, __LINE__, #a1, #a2, a1, a2, TEST_LE) | 204 | assert_u_int(__FILE__, __LINE__, #a1, #a2, a1, a2, TEST_LE) |
205 | #define ASSERT_LONG_LE(a1, a2) \ | ||
206 | assert_long(__FILE__, __LINE__, #a1, #a2, a1, a2, TEST_LE) | ||
196 | #define ASSERT_LONG_LONG_LE(a1, a2) \ | 207 | #define ASSERT_LONG_LONG_LE(a1, a2) \ |
197 | assert_long_long(__FILE__, __LINE__, #a1, #a2, a1, a2, TEST_LE) | 208 | assert_long_long(__FILE__, __LINE__, #a1, #a2, a1, a2, TEST_LE) |
198 | #define ASSERT_CHAR_LE(a1, a2) \ | 209 | #define ASSERT_CHAR_LE(a1, a2) \ |
@@ -220,6 +231,8 @@ void assert_u64(const char *file, int line, | |||
220 | assert_size_t(__FILE__, __LINE__, #a1, #a2, a1, a2, TEST_GT) | 231 | assert_size_t(__FILE__, __LINE__, #a1, #a2, a1, a2, TEST_GT) |
221 | #define ASSERT_U_INT_GT(a1, a2) \ | 232 | #define ASSERT_U_INT_GT(a1, a2) \ |
222 | assert_u_int(__FILE__, __LINE__, #a1, #a2, a1, a2, TEST_GT) | 233 | assert_u_int(__FILE__, __LINE__, #a1, #a2, a1, a2, TEST_GT) |
234 | #define ASSERT_LONG_GT(a1, a2) \ | ||
235 | assert_long(__FILE__, __LINE__, #a1, #a2, a1, a2, TEST_GT) | ||
223 | #define ASSERT_LONG_LONG_GT(a1, a2) \ | 236 | #define ASSERT_LONG_LONG_GT(a1, a2) \ |
224 | assert_long_long(__FILE__, __LINE__, #a1, #a2, a1, a2, TEST_GT) | 237 | assert_long_long(__FILE__, __LINE__, #a1, #a2, a1, a2, TEST_GT) |
225 | #define ASSERT_CHAR_GT(a1, a2) \ | 238 | #define ASSERT_CHAR_GT(a1, a2) \ |
@@ -247,6 +260,8 @@ void assert_u64(const char *file, int line, | |||
247 | assert_size_t(__FILE__, __LINE__, #a1, #a2, a1, a2, TEST_GE) | 260 | assert_size_t(__FILE__, __LINE__, #a1, #a2, a1, a2, TEST_GE) |
248 | #define ASSERT_U_INT_GE(a1, a2) \ | 261 | #define ASSERT_U_INT_GE(a1, a2) \ |
249 | assert_u_int(__FILE__, __LINE__, #a1, #a2, a1, a2, TEST_GE) | 262 | assert_u_int(__FILE__, __LINE__, #a1, #a2, a1, a2, TEST_GE) |
263 | #define ASSERT_LONG_GE(a1, a2) \ | ||
264 | assert_long(__FILE__, __LINE__, #a1, #a2, a1, a2, TEST_GE) | ||
250 | #define ASSERT_LONG_LONG_GE(a1, a2) \ | 265 | #define ASSERT_LONG_LONG_GE(a1, a2) \ |
251 | assert_long_long(__FILE__, __LINE__, #a1, #a2, a1, a2, TEST_GE) | 266 | assert_long_long(__FILE__, __LINE__, #a1, #a2, a1, a2, TEST_GE) |
252 | #define ASSERT_CHAR_GE(a1, a2) \ | 267 | #define ASSERT_CHAR_GE(a1, a2) \ |
diff --git a/regress/unittests/utf8/tests.c b/regress/unittests/utf8/tests.c index 31f9fe9c3..f0bbca509 100644 --- a/regress/unittests/utf8/tests.c +++ b/regress/unittests/utf8/tests.c | |||
@@ -1,4 +1,4 @@ | |||
1 | /* $OpenBSD: tests.c,v 1.3 2016/12/19 04:55:18 djm Exp $ */ | 1 | /* $OpenBSD: tests.c,v 1.4 2017/02/19 00:11:29 djm Exp $ */ |
2 | /* | 2 | /* |
3 | * Regress test for the utf8.h *mprintf() API | 3 | * Regress test for the utf8.h *mprintf() API |
4 | * | 4 | * |
@@ -15,10 +15,7 @@ | |||
15 | 15 | ||
16 | #include "utf8.h" | 16 | #include "utf8.h" |
17 | 17 | ||
18 | void badarg(void); | 18 | static void |
19 | void one(const char *, const char *, int, int, int, const char *); | ||
20 | |||
21 | void | ||
22 | badarg(void) | 19 | badarg(void) |
23 | { | 20 | { |
24 | char buf[16]; | 21 | char buf[16]; |
@@ -33,8 +30,8 @@ badarg(void) | |||
33 | TEST_DONE(); | 30 | TEST_DONE(); |
34 | } | 31 | } |
35 | 32 | ||
36 | void | 33 | static void |
37 | one(const char *name, const char *mbs, int width, | 34 | one(int utf8, const char *name, const char *mbs, int width, |
38 | int wantwidth, int wantlen, const char *wants) | 35 | int wantwidth, int wantlen, const char *wants) |
39 | { | 36 | { |
40 | char buf[16]; | 37 | char buf[16]; |
@@ -43,7 +40,7 @@ one(const char *name, const char *mbs, int width, | |||
43 | 40 | ||
44 | if (wantlen == -2) | 41 | if (wantlen == -2) |
45 | wantlen = strlen(wants); | 42 | wantlen = strlen(wants); |
46 | (void)strlcpy(buf, "utf8_", sizeof(buf)); | 43 | (void)strlcpy(buf, utf8 ? "utf8_" : "c_", sizeof(buf)); |
47 | (void)strlcat(buf, name, sizeof(buf)); | 44 | (void)strlcat(buf, name, sizeof(buf)); |
48 | TEST_START(buf); | 45 | TEST_START(buf); |
49 | wp = wantwidth == -2 ? NULL : &width; | 46 | wp = wantwidth == -2 ? NULL : &width; |
@@ -65,19 +62,41 @@ tests(void) | |||
65 | TEST_DONE(); | 62 | TEST_DONE(); |
66 | 63 | ||
67 | badarg(); | 64 | badarg(); |
68 | one("empty", "", 2, 0, 0, ""); | 65 | one(1, "empty", "", 2, 0, 0, ""); |
69 | one("ascii", "x", -2, -2, -2, "x"); | 66 | one(1, "ascii", "x", -2, -2, -2, "x"); |
70 | one("newline", "a\nb", -2, -2, -2, "a\nb"); | 67 | one(1, "newline", "a\nb", -2, -2, -2, "a\nb"); |
71 | one("cr", "a\rb", -2, -2, -2, "a\rb"); | 68 | one(1, "cr", "a\rb", -2, -2, -2, "a\rb"); |
72 | one("tab", "a\tb", -2, -2, -2, "a\tb"); | 69 | one(1, "tab", "a\tb", -2, -2, -2, "a\tb"); |
73 | one("esc", "\033x", -2, -2, -2, "\\033x"); | 70 | one(1, "esc", "\033x", -2, -2, -2, "\\033x"); |
74 | one("inv_badbyte", "\377x", -2, -2, -2, "\\377x"); | 71 | one(1, "inv_badbyte", "\377x", -2, -2, -2, "\\377x"); |
75 | one("inv_nocont", "\341x", -2, -2, -2, "\\341x"); | 72 | one(1, "inv_nocont", "\341x", -2, -2, -2, "\\341x"); |
76 | one("inv_nolead", "a\200b", -2, -2, -2, "a\\200b"); | 73 | one(1, "inv_nolead", "a\200b", -2, -2, -2, "a\\200b"); |
77 | one("sz_ascii", "1234567890123456", -2, -2, 16, "123456789012345"); | 74 | one(1, "sz_ascii", "1234567890123456", -2, -2, 16, "123456789012345"); |
78 | one("sz_esc", "123456789012\033", -2, -2, 16, "123456789012"); | 75 | one(1, "sz_esc", "123456789012\033", -2, -2, 16, "123456789012"); |
79 | one("width_ascii", "123", 2, 2, -1, "12"); | 76 | one(1, "width_ascii", "123", 2, 2, -1, "12"); |
80 | one("width_double", "a\343\201\201", 2, 1, -1, "a"); | 77 | one(1, "width_double", "a\343\201\201", 2, 1, -1, "a"); |
81 | one("double_fit", "a\343\201\201", 3, 3, 4, "a\343\201\201"); | 78 | one(1, "double_fit", "a\343\201\201", 3, 3, 4, "a\343\201\201"); |
82 | one("double_spc", "a\343\201\201", 4, 3, 4, "a\343\201\201"); | 79 | one(1, "double_spc", "a\343\201\201", 4, 3, 4, "a\343\201\201"); |
80 | |||
81 | TEST_START("C_setlocale"); | ||
82 | loc = setlocale(LC_CTYPE, "C"); | ||
83 | ASSERT_PTR_NE(loc, NULL); | ||
84 | TEST_DONE(); | ||
85 | |||
86 | badarg(); | ||
87 | one(0, "empty", "", 2, 0, 0, ""); | ||
88 | one(0, "ascii", "x", -2, -2, -2, "x"); | ||
89 | one(0, "newline", "a\nb", -2, -2, -2, "a\nb"); | ||
90 | one(0, "cr", "a\rb", -2, -2, -2, "a\rb"); | ||
91 | one(0, "tab", "a\tb", -2, -2, -2, "a\tb"); | ||
92 | one(0, "esc", "\033x", -2, -2, -2, "\\033x"); | ||
93 | one(0, "inv_badbyte", "\377x", -2, -2, -2, "\\377x"); | ||
94 | one(0, "inv_nocont", "\341x", -2, -2, -2, "\\341x"); | ||
95 | one(0, "inv_nolead", "a\200b", -2, -2, -2, "a\\200b"); | ||
96 | one(0, "sz_ascii", "1234567890123456", -2, -2, 16, "123456789012345"); | ||
97 | one(0, "sz_esc", "123456789012\033", -2, -2, 16, "123456789012"); | ||
98 | one(0, "width_ascii", "123", 2, 2, -1, "12"); | ||
99 | one(0, "width_double", "a\343\201\201", 2, 1, -1, "a"); | ||
100 | one(0, "double_fit", "a\343\201\201", 7, 5, -1, "a\\343"); | ||
101 | one(0, "double_spc", "a\343\201\201", 13, 13, 13, "a\\343\\201\\201"); | ||
83 | } | 102 | } |