Lines Matching +full:j +full:- +full:to +full:- +full:k

1 // SPDX-License-Identifier: GPL-2.0-only
22 unsigned i, j, k; in string_test_memset16() local
29 for (j = 0; j < 256; j++) { in string_test_memset16()
31 memset16(p + i, 0xb1b2, j); in string_test_memset16()
32 for (k = 0; k < 512; k++) { in string_test_memset16()
33 v = p[k]; in string_test_memset16()
34 if (k < i) { in string_test_memset16()
36 "i:%d j:%d k:%d", i, j, k); in string_test_memset16()
37 } else if (k < i + j) { in string_test_memset16()
39 "i:%d j:%d k:%d", i, j, k); in string_test_memset16()
42 "i:%d j:%d k:%d", i, j, k); in string_test_memset16()
51 unsigned i, j, k; in string_test_memset32() local
58 for (j = 0; j < 256; j++) { in string_test_memset32()
60 memset32(p + i, 0xb1b2b3b4, j); in string_test_memset32()
61 for (k = 0; k < 512; k++) { in string_test_memset32()
62 v = p[k]; in string_test_memset32()
63 if (k < i) { in string_test_memset32()
65 "i:%d j:%d k:%d", i, j, k); in string_test_memset32()
66 } else if (k < i + j) { in string_test_memset32()
68 "i:%d j:%d k:%d", i, j, k); in string_test_memset32()
71 "i:%d j:%d k:%d", i, j, k); in string_test_memset32()
80 unsigned i, j, k; in string_test_memset64() local
87 for (j = 0; j < 256; j++) { in string_test_memset64()
89 memset64(p + i, 0xb1b2b3b4b5b6b7b8ULL, j); in string_test_memset64()
90 for (k = 0; k < 512; k++) { in string_test_memset64()
91 v = p[k]; in string_test_memset64()
92 if (k < i) { in string_test_memset64()
94 "i:%d j:%d k:%d", i, j, k); in string_test_memset64()
95 } else if (k < i + j) { in string_test_memset64()
97 "i:%d j:%d k:%d", i, j, k); in string_test_memset64()
100 "i:%d j:%d k:%d", i, j, k); in string_test_memset64()
116 KUNIT_ASSERT_EQ_MSG(test, result - test_string, i, in string_test_strchr()
135 int i, j; in string_test_strnchr() local
138 for (j = 0; j < strlen(test_string) + 2; j++) { in string_test_strnchr()
139 result = strnchr(test_string, j, test_string[i]); in string_test_strnchr()
140 if (j <= i) { in string_test_strnchr()
142 "char:%c i:%d j:%d", 'a' + i, i, j); in string_test_strnchr()
144 KUNIT_ASSERT_EQ_MSG(test, result - test_string, i, in string_test_strnchr()
145 "char:%c i:%d j:%d", 'a' + i, i, j); in string_test_strnchr()
181 KUNIT_ASSERT_EQ_MSG(test, s->a, strspn(s->str, s->accept), in string_test_strspn()
183 KUNIT_ASSERT_EQ_MSG(test, s->r, strcspn(s->str, s->reject), in string_test_strspn()
195 strcmp_buffer1[STRCMP_LARGE_BUF_LEN - 1] = 0; in strcmp_fill_buffers()
196 strcmp_buffer2[STRCMP_LARGE_BUF_LEN - 1] = 0; in strcmp_fill_buffers()
207 /* Empty string is always lexicographically less than any non-empty string */ in string_test_strcmp()
208 STRCMP_TEST_EXPECT_LOWER(test, strcmp, "", "Non-empty string"); in string_test_strcmp()
265 /* the strings are equal up to STRCMP_CHANGE_POINT */ in string_test_strncmp_long_strings()
282 STRCMP_TEST_EXPECT_EQUAL(test, strcasecmp, "-+**.1230ghTTT~^", "-+**.1230Ghttt~^"); in string_test_strcasecmp()
330 * strscpy_check() - Run a specific test case.
332 * @src: Source string, argument to strscpy_pad()
333 * @count: Size of destination buffer, argument to strscpy_pad()
334 * @expected: Expected return value from call to strscpy_pad()
335 * @chars: Number of characters from the src string expected to be
336 * written to the dst buffer.
360 max_count = sizeof(buf) - 2; /* Space for null and to verify overflow */ in strscpy_check()
361 max_expected = count - 1; /* Space for the null */ in strscpy_check()
372 if (count && written == -E2BIG) { in strscpy_check()
373 KUNIT_ASSERT_EQ_MSG(test, 0, strncmp(buf, src, count - 1), in strscpy_check()
374 "buffer state invalid for -E2BIG"); in strscpy_check()
375 KUNIT_ASSERT_EQ_MSG(test, buf[count - 1], '\0', in strscpy_check()
384 KUNIT_ASSERT_EQ_MSG(test, buf[count - 1], '\0', in strscpy_check()
393 nr_bytes_poison = sizeof(buf) - chars - terminator - pad; in strscpy_check()
395 index = sizeof(buf) - 1 - i; /* Check from the end back */ in strscpy_check()
407 * least 2 characters spare (one for null and one to check for in string_test_strscpy()
409 * strings up to a maximum of 4 characters long and 'count' in string_test_strscpy()
410 * should not exceed 4. To test with longer strings increase in string_test_strscpy()
415 strscpy_check(test, "a", 0, -E2BIG, 0, 0, 0); in string_test_strscpy()
416 strscpy_check(test, "", 0, -E2BIG, 0, 0, 0); in string_test_strscpy()
418 strscpy_check(test, "a", 1, -E2BIG, 0, 1, 0); in string_test_strscpy()
421 strscpy_check(test, "ab", 2, -E2BIG, 1, 1, 0); in string_test_strscpy()
425 strscpy_check(test, "abc", 3, -E2BIG, 2, 1, 0); in string_test_strscpy()
430 strscpy_check(test, "abcd", 4, -E2BIG, 3, 1, 0); in string_test_strscpy()
436 /* Compile-time-known source strings. */ in string_test_strscpy()
440 KUNIT_EXPECT_EQ(test, strscpy(dest, "", 0), -E2BIG); in string_test_strscpy()
442 KUNIT_EXPECT_EQ(test, strscpy(dest, "Fixed", 3), -E2BIG); in string_test_strscpy()
443 KUNIT_EXPECT_EQ(test, strscpy(dest, "Fixed", 1), -E2BIG); in string_test_strscpy()
444 KUNIT_EXPECT_EQ(test, strscpy(dest, "Fixed", 0), -E2BIG); in string_test_strscpy()
445 KUNIT_EXPECT_EQ(test, strscpy(dest, "This is too long", ARRAY_SIZE(dest)), -E2BIG); in string_test_strscpy()
513 /* 2 characters copied in okay, gets to 6 total. */ in string_test_strlcat()
586 /* Copy in a non-NUL-terminated string into exactly right-sized dest. */ in string_test_memtostr()