Lines 50-61
static bool test_codepoint_cmpi(struct torture_context *tctx)
|
Link Here
|
---|
|
50 |
|
50 |
|
51 |
static bool test_strcasecmp_m(struct torture_context *tctx) |
51 |
static bool test_strcasecmp_m(struct torture_context *tctx) |
52 |
{ |
52 |
{ |
|
|
53 |
/* file.{accented e} in iso8859-1 */ |
54 |
const char file_iso8859_1[7] = { 0x66, 0x69, 0x6c, 0x65, 0x2d, 0xe9, 0 }; |
55 |
/* file.{accented e} in utf8 */ |
56 |
const char file_utf8[8] = { 0x66, 0x69, 0x6c, 0x65, 0x2d, 0xc3, 0xa9, 0 }; |
53 |
torture_assert(tctx, strcasecmp_m("foo", "bar") != 0, "different strings"); |
57 |
torture_assert(tctx, strcasecmp_m("foo", "bar") != 0, "different strings"); |
54 |
torture_assert(tctx, strcasecmp_m("foo", "foo") == 0, "same case strings"); |
58 |
torture_assert(tctx, strcasecmp_m("foo", "foo") == 0, "same case strings"); |
55 |
torture_assert(tctx, strcasecmp_m("foo", "Foo") == 0, "different case strings"); |
59 |
torture_assert(tctx, strcasecmp_m("foo", "Foo") == 0, "different case strings"); |
56 |
torture_assert(tctx, strcasecmp_m(NULL, "Foo") != 0, "one NULL"); |
60 |
torture_assert(tctx, strcasecmp_m(NULL, "Foo") != 0, "one NULL"); |
57 |
torture_assert(tctx, strcasecmp_m("foo", NULL) != 0, "other NULL"); |
61 |
torture_assert(tctx, strcasecmp_m("foo", NULL) != 0, "other NULL"); |
58 |
torture_assert(tctx, strcasecmp_m(NULL, NULL) == 0, "both NULL"); |
62 |
torture_assert(tctx, strcasecmp_m(NULL, NULL) == 0, "both NULL"); |
|
|
63 |
torture_assert(tctx, strcasecmp_m(file_iso8859_1, file_utf8) != 0, |
64 |
"file.{accented e} should differ"); |
59 |
return true; |
65 |
return true; |
60 |
} |
66 |
} |
61 |
|
67 |
|
Lines 102-107
static bool test_string_replace_m(struct torture_context *tctx)
|
Link Here
|
---|
|
102 |
|
108 |
|
103 |
static bool test_strncasecmp_m(struct torture_context *tctx) |
109 |
static bool test_strncasecmp_m(struct torture_context *tctx) |
104 |
{ |
110 |
{ |
|
|
111 |
/* file.{accented e} in iso8859-1 */ |
112 |
const char file_iso8859_1[7] = { 0x66, 0x69, 0x6c, 0x65, 0x2d, 0xe9, 0 }; |
113 |
/* file.{accented e} in utf8 */ |
114 |
const char file_utf8[8] = { 0x66, 0x69, 0x6c, 0x65, 0x2d, 0xc3, 0xa9, 0 }; |
105 |
torture_assert(tctx, strncasecmp_m("foo", "bar", 3) != 0, "different strings"); |
115 |
torture_assert(tctx, strncasecmp_m("foo", "bar", 3) != 0, "different strings"); |
106 |
torture_assert(tctx, strncasecmp_m("foo", "foo", 3) == 0, "same case strings"); |
116 |
torture_assert(tctx, strncasecmp_m("foo", "foo", 3) == 0, "same case strings"); |
107 |
torture_assert(tctx, strncasecmp_m("foo", "Foo", 3) == 0, "different case strings"); |
117 |
torture_assert(tctx, strncasecmp_m("foo", "Foo", 3) == 0, "different case strings"); |
Lines 111-116
static bool test_strncasecmp_m(struct torture_context *tctx)
|
Link Here
|
---|
|
111 |
torture_assert(tctx, strncasecmp_m(NULL, "Foo", 3) != 0, "one NULL"); |
121 |
torture_assert(tctx, strncasecmp_m(NULL, "Foo", 3) != 0, "one NULL"); |
112 |
torture_assert(tctx, strncasecmp_m("foo", NULL, 3) != 0, "other NULL"); |
122 |
torture_assert(tctx, strncasecmp_m("foo", NULL, 3) != 0, "other NULL"); |
113 |
torture_assert(tctx, strncasecmp_m(NULL, NULL, 3) == 0, "both NULL"); |
123 |
torture_assert(tctx, strncasecmp_m(NULL, NULL, 3) == 0, "both NULL"); |
|
|
124 |
torture_assert(tctx, strncasecmp_m(file_iso8859_1, file_utf8, 6) != 0, |
125 |
"file.{accented e} should differ"); |
114 |
return true; |
126 |
return true; |
115 |
} |
127 |
} |
116 |
|
128 |
|
117 |
- |
|
|
118 |
-- |
119 |
lib/util/charset/util_str.c | 48 ++++++++++++--------------------------------- |
129 |
lib/util/charset/util_str.c | 48 ++++++++++++--------------------------------- |
120 |
1 file changed, 13 insertions(+), 35 deletions(-) |
130 |
1 file changed, 13 insertions(+), 35 deletions(-) |