Lines Matching +full:parameter +full:- +full:less
1 /* SPDX-License-Identifier: GPL-2.0 */
13 #include <kunit/try-catch.h>
39 /* Maximum size of parameter description string. */
47 * sub-subtest. See the "Subtests" section in
48 * https://node-tap.org/tap-protocol/
55 * enum kunit_status - Type of result for a test or test suite
89 * struct kunit_case - represents an individual test case.
109 * .. code-block:: c
115 * KUNIT_EXPECT_EQ(test, 0, add(-1, 1));
117 * KUNIT_EXPECT_EQ(test, -1, add(INT_MAX, INT_MIN));
151 * KUNIT_CASE - A helper for creating a &struct kunit_case
164 * KUNIT_CASE_ATTR - A helper for creating a &struct kunit_case
176 * KUNIT_CASE_SLOW - A helper for creating a &struct kunit_case
187 * KUNIT_CASE_PARAM - A helper for creation a parameterized &struct kunit_case
190 * @gen_params: a reference to a parameter generator function.
201 * describing the parameter.
208 * KUNIT_CASE_PARAM_ATTR - A helper for creating a parameterized &struct
212 * @gen_params: a reference to a parameter generator function.
222 * struct kunit_suite - describes a related collection of &struct kunit_case
267 * struct kunit - represents a running instance of a test.
284 /* param_value is the current parameter value for a test case. */
286 /* param_index stores the index of the parameter in parameterized tests. */
311 WRITE_ONCE(test->status, KUNIT_FAILURE); in kunit_set_failure()
364 * kunit_test_suites() - used to register one or more &struct kunit_suite
389 * kunit_test_init_section_suites() - used to register one or more &struct
416 for (test_case = suite->test_cases; test_case->run_case; test_case++)
421 * kunit_kmalloc_array() - Like kmalloc_array() except the allocation is *test managed*.
437 * kunit_kmalloc() - Like kmalloc() except the allocation is *test managed*.
453 * kunit_kfree() - Like kfree except for allocations managed by KUnit.
460 * kunit_kzalloc() - Just like kunit_kmalloc(), but zeroes the allocation.
473 * kunit_kcalloc() - Just like kunit_kmalloc_array(), but zeroes the allocation.
488 * kunit_kfree_const() - conditionally free test managed memory
498 * kunit_kstrdup() - Duplicates a string into a test managed allocation.
501 * @str: The NULL-terminated string to duplicate.
522 * kunit_kstrdup_const() - Conditionally duplicates a string into a test managed allocation.
525 * @str: The NULL-terminated string to duplicate.
529 * kunit_kfree_const() -- not kunit_kfree().
535 * kunit_vm_mmap() - Allocate KUnit-tracked vm_mmap() area
556 * kunit_mark_skipped() - Marks @test_or_suite as skipped
568 WRITE_ONCE((test_or_suite)->status, KUNIT_SKIPPED); \
569 scnprintf((test_or_suite)->status_comment, \
575 * kunit_skip() - Marks @test_or_suite as skipped
588 kunit_try_catch_throw(&((test_or_suite)->try_catch)); \
592 * printk and log to per-test or per-suite log buffer. Logging only done
598 kunit_log_append((test_or_suite)->log, fmt, \
604 (test)->name, ##__VA_ARGS__)
607 * kunit_info() - Prints an INFO level message associated with @test.
619 * kunit_warn() - Prints a WARN level message associated with @test.
630 * kunit_err() - Prints an ERROR level message associated with @test.
645 WRITE_ONCE(test->last_seen.file, __FILE__); \
646 WRITE_ONCE(test->last_seen.line, __LINE__); \
650 * KUNIT_SUCCEED() - A no-op expectation. Only exists for code clarity.
695 * KUNIT_FAIL() - Always causes a test to fail when evaluated.
917 * KUNIT_EXPECT_TRUE() - Causes a test failure when the expression is not true.
938 * KUNIT_EXPECT_FALSE() - Makes a test failure when the expression is not false.
957 * KUNIT_EXPECT_EQ() - Sets an expectation that @left and @right are equal.
978 * KUNIT_EXPECT_PTR_EQ() - Expects that pointers @left and @right are equal.
999 * KUNIT_EXPECT_NE() - An expectation that @left and @right are not equal.
1020 * KUNIT_EXPECT_PTR_NE() - Expects that pointers @left and @right are not equal.
1041 * KUNIT_EXPECT_LT() - An expectation that @left is less than @right.
1046 * Sets an expectation that the value that @left evaluates to is less than the
1062 * KUNIT_EXPECT_LE() - Expects that @left is less than or equal to @right.
1067 * Sets an expectation that the value that @left evaluates to is less than or
1083 * KUNIT_EXPECT_GT() - An expectation that @left is greater than @right.
1104 * KUNIT_EXPECT_GE() - Expects that @left is greater than or equal to @right.
1125 * KUNIT_EXPECT_STREQ() - Expects that strings @left and @right are equal.
1146 * KUNIT_EXPECT_STRNEQ() - Expects that strings @left and @right are not equal.
1167 * KUNIT_EXPECT_MEMEQ() - Expects that the first @size bytes of @left and @right are equal.
1194 * KUNIT_EXPECT_MEMNEQ() - Expects that the first @size bytes of @left and @right are not equal.
1221 * KUNIT_EXPECT_NULL() - Expects that @ptr is null.
1242 * KUNIT_EXPECT_NOT_NULL() - Expects that @ptr is not null.
1263 * KUNIT_EXPECT_NOT_ERR_OR_NULL() - Expects that @ptr is not null and not err.
1283 * KUNIT_FAIL_AND_ABORT() - Always causes a test to fail and abort when evaluated.
1297 * KUNIT_ASSERT_TRUE() - Sets an assertion that @condition is true.
1318 * KUNIT_ASSERT_FALSE() - Sets an assertion that @condition is false.
1337 * KUNIT_ASSERT_EQ() - Sets an assertion that @left and @right are equal.
1357 * KUNIT_ASSERT_PTR_EQ() - Asserts that pointers @left and @right are equal.
1377 * KUNIT_ASSERT_NE() - An assertion that @left and @right are not equal.
1397 * KUNIT_ASSERT_PTR_NE() - Asserts that pointers @left and @right are not equal.
1398 * KUNIT_ASSERT_PTR_EQ() - Asserts that pointers @left and @right are equal.
1417 * KUNIT_ASSERT_LT() - An assertion that @left is less than @right.
1422 * Sets an assertion that the value that @left evaluates to is less than the
1437 * KUNIT_ASSERT_LE() - An assertion that @left is less than or equal to @right.
1442 * Sets an assertion that the value that @left evaluates to is less than or
1458 * KUNIT_ASSERT_GT() - An assertion that @left is greater than @right.
1479 * KUNIT_ASSERT_GE() - Assertion that @left is greater than or equal to @right.
1500 * KUNIT_ASSERT_STREQ() - An assertion that strings @left and @right are equal.
1520 * KUNIT_ASSERT_STRNEQ() - An assertion that strings @left and @right are not equal.
1541 * KUNIT_ASSERT_MEMEQ() - Asserts that the first @size bytes of @left and @right are equal.
1568 * KUNIT_ASSERT_MEMNEQ() - Asserts that the first @size bytes of @left and @right are not equal.
1595 * KUNIT_ASSERT_NULL() - Asserts that pointers @ptr is null.
1616 * KUNIT_ASSERT_NOT_NULL() - Asserts that pointers @ptr is not null.
1637 * KUNIT_ASSERT_NOT_ERR_OR_NULL() - Assertion that @ptr is not null and not err.
1657 * KUNIT_ARRAY_PARAM() - Define test parameter generator from an array.
1658 * @name: prefix for the test parameter generator function.
1668 if (__next - (array) < ARRAY_SIZE((array))) { \
1678 * KUNIT_ARRAY_PARAM_DESC() - Define test parameter generator from an array.
1679 * @name: prefix for the test parameter generator function.
1689 if (__next - (array) < ARRAY_SIZE((array))) { \
1690 strscpy(desc, __next->desc_member, KUNIT_PARAM_DESC_SIZE); \