Lines Matching refs:test
25 static void tc(struct kunit *test, char *src, int count, int expected, in tc() argument
36 KUNIT_ASSERT_TRUE_MSG(test, src != NULL, in tc()
44 KUNIT_ASSERT_LE_MSG(test, count, max_count, in tc()
46 KUNIT_EXPECT_LE_MSG(test, expected, max_expected, in tc()
51 KUNIT_ASSERT_EQ(test, written, expected); in tc()
54 KUNIT_ASSERT_EQ_MSG(test, 0, strncmp(buf, src, count - 1), in tc()
56 KUNIT_ASSERT_EQ_MSG(test, buf[count - 1], '\0', in tc()
61 KUNIT_ASSERT_EQ_MSG(test, buf[i], src[i], in tc()
65 KUNIT_ASSERT_EQ_MSG(test, buf[count - 1], '\0', in tc()
70 KUNIT_ASSERT_EQ_MSG(test, buf[index], '\0', in tc()
77 KUNIT_ASSERT_EQ_MSG(test, buf[index], POISON, in tc()
82 static void strscpy_test(struct kunit *test) in strscpy_test() argument
96 tc(test, "a", 0, -E2BIG, 0, 0, 0); in strscpy_test()
97 tc(test, "", 0, -E2BIG, 0, 0, 0); in strscpy_test()
99 tc(test, "a", 1, -E2BIG, 0, 1, 0); in strscpy_test()
100 tc(test, "", 1, 0, 0, 1, 0); in strscpy_test()
102 tc(test, "ab", 2, -E2BIG, 1, 1, 0); in strscpy_test()
103 tc(test, "a", 2, 1, 1, 1, 0); in strscpy_test()
104 tc(test, "", 2, 0, 0, 1, 1); in strscpy_test()
106 tc(test, "abc", 3, -E2BIG, 2, 1, 0); in strscpy_test()
107 tc(test, "ab", 3, 2, 2, 1, 0); in strscpy_test()
108 tc(test, "a", 3, 1, 1, 1, 1); in strscpy_test()
109 tc(test, "", 3, 0, 0, 1, 2); in strscpy_test()
111 tc(test, "abcd", 4, -E2BIG, 3, 1, 0); in strscpy_test()
112 tc(test, "abc", 4, 3, 3, 1, 0); in strscpy_test()
113 tc(test, "ab", 4, 2, 2, 1, 1); in strscpy_test()
114 tc(test, "a", 4, 1, 1, 1, 2); in strscpy_test()
115 tc(test, "", 4, 0, 0, 1, 3); in strscpy_test()
118 KUNIT_EXPECT_EQ(test, strscpy(dest, "", ARRAY_SIZE(dest)), 0); in strscpy_test()
119 KUNIT_EXPECT_EQ(test, strscpy(dest, "", 3), 0); in strscpy_test()
120 KUNIT_EXPECT_EQ(test, strscpy(dest, "", 1), 0); in strscpy_test()
121 KUNIT_EXPECT_EQ(test, strscpy(dest, "", 0), -E2BIG); in strscpy_test()
122 KUNIT_EXPECT_EQ(test, strscpy(dest, "Fixed", ARRAY_SIZE(dest)), 5); in strscpy_test()
123 KUNIT_EXPECT_EQ(test, strscpy(dest, "Fixed", 3), -E2BIG); in strscpy_test()
124 KUNIT_EXPECT_EQ(test, strscpy(dest, "Fixed", 1), -E2BIG); in strscpy_test()
125 KUNIT_EXPECT_EQ(test, strscpy(dest, "Fixed", 0), -E2BIG); in strscpy_test()
126 KUNIT_EXPECT_EQ(test, strscpy(dest, "This is too long", ARRAY_SIZE(dest)), -E2BIG); in strscpy_test()