Lines Matching +full:use +full:- +full:cases

1 // SPDX-License-Identifier: GPL-2.0
3 * Example KUnit test to show how to use KUnit.
55 * This is run once before all test cases in the suite.
66 * This is run once after all test cases in the suite.
150 KUNIT_EXPECT_GT_MSG(test, sizeof(int), 0, "Your ints are 0-bit?!"); in example_all_expect_macros_test()
151 KUNIT_ASSERT_GT_MSG(test, sizeof(int), 0, "Your ints are 0-bit?!"); in example_all_expect_macros_test()
168 return i - 1; in subtract_one()
174 * to change the static function to a non-static exported function.
182 * This test shows the use of static stubs.
201 * This test shows the use of static stubs when the function being
202 * replaced is provided as a pointer-to-function instead of the
205 * instead of having to change the static function to a non-static
235 snprintf(desc, KUNIT_PARAM_DESC_SIZE, "example value %d", p->value); in example_param_get_desc()
241 * This test shows the use of params.
245 const struct example_param *param = test->param_value; in example_params_test()
251 if (!is_power_of_2(param->value)) in example_params_test()
252 kunit_skip(test, "unsupported param value %d", param->value); in example_params_test()
254 /* You can use param values for parameterized testing */ in example_params_test()
255 KUNIT_EXPECT_EQ(test, param->value % param->value, 0); in example_params_test()
259 * This test shows the use of test->priv.
263 /* unless setup in suite->init(), test->priv is NULL */ in example_priv_test()
264 KUNIT_ASSERT_NULL(test, test->priv); in example_priv_test()
267 test->priv = kunit_kzalloc(test, 1, GFP_KERNEL); in example_priv_test()
268 KUNIT_EXPECT_NOT_NULL(test, test->priv); in example_priv_test()
269 KUNIT_ASSERT_PTR_EQ(test, test->priv, kunit_get_current_test()->priv); in example_priv_test()
281 * Here we make a list of all the test cases we want to add to the test suite
288 * use KUnit, just know that this is how you associate test cases with a
306 * Test cases are defined as belonging to the suite by adding them to