kunit: add example test case showing off all the expect macros
authorDaniel Latypov <dlatypov@google.com>
Thu, 13 Jan 2022 16:59:26 +0000 (08:59 -0800)
committerShuah Khan <skhan@linuxfoundation.org>
Tue, 25 Jan 2022 19:49:20 +0000 (12:49 -0700)
commit7b3391057fa1921ba84ef17852a6998c0af27e4d
tree0f73ca25b01e43875a6c15e013b68f6779d9f58a
parente783362eb54cd99b2cac8b3a9aeac942e6f6ac07
kunit: add example test case showing off all the expect macros

Currently, these macros are only really documented near the bottom of
https://www.kernel.org/doc/html/latest/dev-tools/kunit/api/test.html#c.KUNIT_FAIL.

E.g. it's likely someone might just not realize that
KUNIT_EXPECT_STREQ() exists and instead use KUNIT_EXPECT_FALSE(strcmp())
or similar.

This can also serve as a basic smoketest that the KUnit assert machinery
still works for all the macros.

Signed-off-by: Daniel Latypov <dlatypov@google.com>
Reviewed-by: Brendan Higgins <brendanhiggins@google.com>
Reviewed-by: David Gow <davidgow@google.com>
Signed-off-by: Shuah Khan <skhan@linuxfoundation.org>
lib/kunit/kunit-example-test.c