Lines Matching +full:p +full:- +full:256
1 // SPDX-License-Identifier: GPL-2.0-only
23 u16 v, *p; in string_test_memset16() local
25 p = kunit_kzalloc(test, 256 * 2 * 2, GFP_KERNEL); in string_test_memset16()
26 KUNIT_ASSERT_NOT_ERR_OR_NULL(test, p); in string_test_memset16()
28 for (i = 0; i < 256; i++) { in string_test_memset16()
29 for (j = 0; j < 256; j++) { in string_test_memset16()
30 memset(p, 0xa1, 256 * 2 * sizeof(v)); in string_test_memset16()
31 memset16(p + i, 0xb1b2, j); in string_test_memset16()
33 v = p[k]; in string_test_memset16()
52 u32 v, *p; in string_test_memset32() local
54 p = kunit_kzalloc(test, 256 * 2 * 4, GFP_KERNEL); in string_test_memset32()
55 KUNIT_ASSERT_NOT_ERR_OR_NULL(test, p); in string_test_memset32()
57 for (i = 0; i < 256; i++) { in string_test_memset32()
58 for (j = 0; j < 256; j++) { in string_test_memset32()
59 memset(p, 0xa1, 256 * 2 * sizeof(v)); in string_test_memset32()
60 memset32(p + i, 0xb1b2b3b4, j); in string_test_memset32()
62 v = p[k]; in string_test_memset32()
81 u64 v, *p; in string_test_memset64() local
83 p = kunit_kzalloc(test, 256 * 2 * 8, GFP_KERNEL); in string_test_memset64()
84 KUNIT_ASSERT_NOT_ERR_OR_NULL(test, p); in string_test_memset64()
86 for (i = 0; i < 256; i++) { in string_test_memset64()
87 for (j = 0; j < 256; j++) { in string_test_memset64()
88 memset(p, 0xa1, 256 * 2 * sizeof(v)); in string_test_memset64()
89 memset64(p + i, 0xb1b2b3b4b5b6b7b8ULL, j); in string_test_memset64()
91 v = p[k]; in string_test_memset64()
116 KUNIT_ASSERT_EQ_MSG(test, result - test_string, i, in string_test_strchr()
144 KUNIT_ASSERT_EQ_MSG(test, result - test_string, i, 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()
282 STRCMP_TEST_EXPECT_EQUAL(test, strcasecmp, "-+**.1230ghTTT~^", "-+**.1230Ghttt~^"); in string_test_strcasecmp()
330 * strscpy_check() - Run a specific test case.
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()
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()
586 /* Copy in a non-NUL-terminated string into exactly right-sized dest. */ in string_test_memtostr()