Lines Matching full:test
3 * Example KUnit test to show how to use KUnit.
9 #include <kunit/test.h>
12 * This is the most fundamental element of KUnit, the test case. A test case
14 * any expectations or assertions are not met, the test fails; otherwise, the
15 * test passes.
17 * In KUnit, a test case is just a function with the signature
19 * information about the current test.
21 static void example_simple_test(struct kunit *test) in example_simple_test() argument
25 * to test a piece of code, you set some expectations about what the in example_simple_test()
26 * code should do. KUnit then runs the test and verifies that the code's in example_simple_test()
29 KUNIT_EXPECT_EQ(test, 1 + 1, 2); in example_simple_test()
33 * This is run once before each test case, see the comment on
36 static int example_test_init(struct kunit *test) in example_test_init() argument
38 kunit_info(test, "initializing\n"); in example_test_init()
44 * Here we make a list of all the test cases we want to add to the test suite
49 * This is a helper to create a test case object from a test case
51 * use KUnit, just know that this is how you associate test cases with a
52 * test suite.
61 * Test cases are defined as belonging to the suite by adding them to
65 * will be used by every test; this is accomplished with an `init` function
66 * which runs before each test case is invoked. Similarly, an `exit` function
67 * may be specified which runs after every test case and can be used to for
68 * cleanup. For clarity, running tests in a test suite would behave as follows:
70 * suite.init(test);
71 * suite.test_case[0](test);
72 * suite.exit(test);
73 * suite.init(test);
74 * suite.test_case[1](test);
75 * suite.exit(test);
85 * This registers the above test suite telling KUnit that this is a suite of