From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1751345AbdFESUd (ORCPT ); Mon, 5 Jun 2017 14:20:33 -0400 Received: from resqmta-po-10v.sys.comcast.net ([96.114.154.169]:42338 "EHLO resqmta-po-10v.sys.comcast.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1751178AbdFESUa (ORCPT ); Mon, 5 Jun 2017 14:20:30 -0400 Reply-To: shuah@kernel.org Subject: Re: [PATCH v5 7/7] Documentation/dev-tools: Add kselftest_harness documentation To: =?UTF-8?Q?Micka=c3=abl_Sala=c3=bcn?= , linux-kernel@vger.kernel.org Cc: Andy Lutomirski , Jonathan Corbet , Kees Cook , Will Drewry , linux-doc@vger.kernel.org, linux-kselftest@vger.kernel.org, Shuah Khan , Shuah Khan References: <20170526184402.30267-1-mic@digikod.net> <20170526184402.30267-8-mic@digikod.net> <84d3e707-9a8f-9f97-41d2-42b8a110adb2@kernel.org> <479279e6-8060-c924-c8eb-dc7763923a4b@digikod.net> From: Shuah Khan Message-ID: <9e41f071-26df-18bd-21e1-6b0b588531ed@kernel.org> Date: Mon, 5 Jun 2017 12:20:27 -0600 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:52.0) Gecko/20100101 Thunderbird/52.1.1 MIME-Version: 1.0 In-Reply-To: <479279e6-8060-c924-c8eb-dc7763923a4b@digikod.net> Content-Type: multipart/signed; micalg=pgp-sha256; protocol="application/pgp-signature"; boundary="Uw3RVnRlVTVeSlvnihDCLk78iO4DOegpL" X-CMAE-Envelope: MS4wfBRljJPBkW7JffF4uBLGfw2HJRJaiCZ5aXeClKz61VIpYvTVl3XGvq0CRXf5pJNtsZr3LIKFiSiMuhUTfU/h9W59JYtbNesvSw4Xq952MlTjS6S1GLqs JLUwM2ngHoPHd12KSLA2NJ+czML5usmjYVr7GYwETRoYvbnPXcnkn6w7HPus7ytYPkbG/Aox5kfs5DQ4J65O7vzp0n55I3zxotAz9o+uS07a2WnkUjF8cvgf zdykIZMeI9Y/dwFm4hff5FFQMoxRO4NsAIVHaqY0tl82nSCtlGpmbT6AR+q3iqlk5mk8pvsQPyaoM2PMmhKKadKe0wv3Ny9V0Gv0AoQp5Hkbe/pVlROfFYx/ zEDwc3xRedOBOhNEP/GXeJ2efbJhs/TJGH0OBkm7eO//Hy1ea5tMEmRoVVaDhHPuuJcTVm5hAuTmZbNcLElfcpLz04n6rAD36htWHhQ3UR0I+Jl0Cd8= Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org This is an OpenPGP/MIME signed message (RFC 4880 and 3156) --Uw3RVnRlVTVeSlvnihDCLk78iO4DOegpL Content-Type: multipart/mixed; boundary="LM8wMi28qjLae66jsO5HnxFIgaNaXnw3a"; protected-headers="v1" From: Shuah Khan Reply-To: shuah@kernel.org To: =?UTF-8?Q?Micka=c3=abl_Sala=c3=bcn?= , linux-kernel@vger.kernel.org Cc: Andy Lutomirski , Jonathan Corbet , Kees Cook , Will Drewry , linux-doc@vger.kernel.org, linux-kselftest@vger.kernel.org, Shuah Khan , Shuah Khan Message-ID: <9e41f071-26df-18bd-21e1-6b0b588531ed@kernel.org> Subject: Re: [PATCH v5 7/7] Documentation/dev-tools: Add kselftest_harness documentation References: <20170526184402.30267-1-mic@digikod.net> <20170526184402.30267-8-mic@digikod.net> <84d3e707-9a8f-9f97-41d2-42b8a110adb2@kernel.org> <479279e6-8060-c924-c8eb-dc7763923a4b@digikod.net> In-Reply-To: <479279e6-8060-c924-c8eb-dc7763923a4b@digikod.net> --LM8wMi28qjLae66jsO5HnxFIgaNaXnw3a Content-Type: text/plain; charset=utf-8 Content-Language: en-US Content-Transfer-Encoding: quoted-printable On 06/03/2017 05:17 AM, Micka=C3=ABl Sala=C3=BCn wrote: >=20 > On 02/06/2017 22:02, Shuah Khan wrote: >> Hi Micka=C3=ABl, >> >> On 05/26/2017 12:44 PM, Micka=C3=ABl Sala=C3=BCn wrote: >>> Add ReST metadata to kselftest_harness.h to be able to include the >>> comments in the Sphinx documentation. >>> >> >> These don't belong the change log. These types of changes are for >> reviewers benefit and should be added between the sign-of block >> and the start of diff. >=20 > OK, I didn't know this rule, which seems different from one maintainer > to another. I'll take this into account the next time. It is a standard practice. Not just mine. If there is any information from these version to version differences that belong in the changelog, they need to be in the changelog format. >=20 >> >> I had to fix a few patches in this series before commit. >> >>> Changes since v4: >>> * exclude the TEST_API() changes (requested by Kees Cook) >>> >>> Changes since v3: >>> * document macros as actual functions (suggested by Jonathan Corbet) >>> * remove the TEST_API() wrapper to expose the underlying macro argume= nts >>> to the documentation tools >>> * move and cleanup comments >>> >>> Changes since v2: >>> * add reference to the full documentation in the header file (suggest= ed >>> by Kees Cook) >> >>> >>> Signed-off-by: Micka=C3=ABl Sala=C3=BCn >>> Cc: Andy Lutomirski >>> Cc: Jonathan Corbet >>> Cc: Kees Cook >>> Cc: Shuah Khan >>> Cc: Will Drewry >> >> git am isn't happy: >> >> Applying: Documentation/dev-tools: Add kselftest_harness documentation= >> .git/rebase-apply/patch:47: new blank line at EOF. >> + >> warning: 1 line adds whitespace errors. >> >> Please fix and resend. >=20 > I didn't try to apply the series with "git am" since neither "git > format-patch" nor scripts/checkpatch.pl output a warning. >=20 > This "git am" warning is about the last line of the ReST file which end= > with an empty line. I will fix it if needed. Yeah that is what it is complaining about. Checkpatch didn't complain. Fix it and resend. I don't like git am complaining about patches. :) -- Shuah >=20 >> >> -- Shuah >> >>> --- >>> Documentation/dev-tools/kselftest.rst | 34 +++ >>> tools/testing/selftests/kselftest_harness.h | 415 ++++++++++++++++++= ++++------ >>> 2 files changed, 364 insertions(+), 85 deletions(-) >>> >>> diff --git a/Documentation/dev-tools/kselftest.rst b/Documentation/de= v-tools/kselftest.rst >>> index 9232ce94612c..a92fa181b6cf 100644 >>> --- a/Documentation/dev-tools/kselftest.rst >>> +++ b/Documentation/dev-tools/kselftest.rst >>> @@ -120,3 +120,37 @@ Contributing new tests (details) >>> executable which is not tested by default. >>> TEST_FILES, TEST_GEN_FILES mean it is the file which is used by >>> test. >>> + >>> +Test Harness >>> +=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D >>> + >>> +The kselftest_harness.h file contains useful helpers to build tests.= The tests >>> +from tools/testing/selftests/seccomp/seccomp_bpf.c can be used as ex= ample. >>> + >>> +Example >>> +------- >>> + >>> +.. kernel-doc:: tools/testing/selftests/kselftest_harness.h >>> + :doc: example >>> + >>> + >>> +Helpers >>> +------- >>> + >>> +.. kernel-doc:: tools/testing/selftests/kselftest_harness.h >>> + :functions: TH_LOG TEST TEST_SIGNAL FIXTURE FIXTURE_DATA FIXTURE= _SETUP >>> + FIXTURE_TEARDOWN TEST_F TEST_HARNESS_MAIN >>> + >>> +Operators >>> +--------- >>> + >>> +.. kernel-doc:: tools/testing/selftests/kselftest_harness.h >>> + :doc: operators >>> + >>> +.. kernel-doc:: tools/testing/selftests/kselftest_harness.h >>> + :functions: ASSERT_EQ ASSERT_NE ASSERT_LT ASSERT_LE ASSERT_GT AS= SERT_GE >>> + ASSERT_NULL ASSERT_TRUE ASSERT_NULL ASSERT_TRUE ASSE= RT_FALSE >>> + ASSERT_STREQ ASSERT_STRNE EXPECT_EQ EXPECT_NE EXPECT= _LT >>> + EXPECT_LE EXPECT_GT EXPECT_GE EXPECT_NULL EXPECT_TRU= E >>> + EXPECT_FALSE EXPECT_STREQ EXPECT_STRNE >>> + >>> diff --git a/tools/testing/selftests/kselftest_harness.h b/tools/test= ing/selftests/kselftest_harness.h >>> index 45f807ce37e1..c56f72e07cd7 100644 >>> --- a/tools/testing/selftests/kselftest_harness.h >>> +++ b/tools/testing/selftests/kselftest_harness.h >>> @@ -4,41 +4,49 @@ >>> * >>> * kselftest_harness.h: simple C unit test helper. >>> * >>> - * Usage: >>> - * #include "../kselftest_harness.h" >>> - * TEST(standalone_test) { >>> - * do_some_stuff; >>> - * EXPECT_GT(10, stuff) { >>> - * stuff_state_t state; >>> - * enumerate_stuff_state(&state); >>> - * TH_LOG("expectation failed with state: %s", state.msg); >>> - * } >>> - * more_stuff; >>> - * ASSERT_NE(some_stuff, NULL) TH_LOG("how did it happen?!"); >>> - * last_stuff; >>> - * EXPECT_EQ(0, last_stuff); >>> - * } >>> - * >>> - * FIXTURE(my_fixture) { >>> - * mytype_t *data; >>> - * int awesomeness_level; >>> - * }; >>> - * FIXTURE_SETUP(my_fixture) { >>> - * self->data =3D mytype_new(); >>> - * ASSERT_NE(NULL, self->data); >>> - * } >>> - * FIXTURE_TEARDOWN(my_fixture) { >>> - * mytype_free(self->data); >>> - * } >>> - * TEST_F(my_fixture, data_is_good) { >>> - * EXPECT_EQ(1, is_my_data_good(self->data)); >>> - * } >>> - * >>> - * TEST_HARNESS_MAIN >>> + * See documentation in Documentation/dev-tools/kselftest.rst >>> * >>> * API inspired by code.google.com/p/googletest >>> */ >>> =20 >>> +/** >>> + * DOC: example >>> + * >>> + * .. code-block:: c >>> + * >>> + * #include "../kselftest_harness.h" >>> + * >>> + * TEST(standalone_test) { >>> + * do_some_stuff; >>> + * EXPECT_GT(10, stuff) { >>> + * stuff_state_t state; >>> + * enumerate_stuff_state(&state); >>> + * TH_LOG("expectation failed with state: %s", state.msg); >>> + * } >>> + * more_stuff; >>> + * ASSERT_NE(some_stuff, NULL) TH_LOG("how did it happen?!"); >>> + * last_stuff; >>> + * EXPECT_EQ(0, last_stuff); >>> + * } >>> + * >>> + * FIXTURE(my_fixture) { >>> + * mytype_t *data; >>> + * int awesomeness_level; >>> + * }; >>> + * FIXTURE_SETUP(my_fixture) { >>> + * self->data =3D mytype_new(); >>> + * ASSERT_NE(NULL, self->data); >>> + * } >>> + * FIXTURE_TEARDOWN(my_fixture) { >>> + * mytype_free(self->data); >>> + * } >>> + * TEST_F(my_fixture, data_is_good) { >>> + * EXPECT_EQ(1, is_my_data_good(self->data)); >>> + * } >>> + * >>> + * TEST_HARNESS_MAIN >>> + */ >>> + >>> #ifndef __KSELFTEST_HARNESS_H >>> #define __KSELFTEST_HARNESS_H >>> =20 >>> @@ -61,10 +69,20 @@ >>> # define TH_LOG_ENABLED 1 >>> #endif >>> =20 >>> -/* TH_LOG(format, ...) >>> +/** >>> + * TH_LOG(fmt, ...) >>> + * >>> + * @fmt: format string >>> + * @...: optional arguments >>> + * >>> + * .. code-block:: c >>> + * >>> + * TH_LOG(format, ...) >>> + * >>> * Optional debug logging function available for use in tests. >>> * Logging may be enabled or disabled by defining TH_LOG_ENABLED. >>> * E.g., #define TH_LOG_ENABLED 1 >>> + * >>> * If no definition is provided, logging is enabled by default. >>> */ >>> #define TH_LOG(fmt, ...) do { \ >>> @@ -77,7 +95,16 @@ >>> fprintf(TH_LOG_STREAM, "%s:%d:%s:" fmt "\n", \ >>> __FILE__, __LINE__, _metadata->name, ##__VA_ARGS__) >>> =20 >>> -/* TEST(name) { implementation } >>> +/** >>> + * TEST(test_name) - Defines the test function and creates the regis= tration >>> + * stub >>> + * >>> + * @test_name: test name >>> + * >>> + * .. code-block:: c >>> + * >>> + * TEST(name) { implementation } >>> + * >>> * Defines a test by name. >>> * Names must be unique and tests must not be run in parallel. The >>> * implementation containing block is a function and scoping should = be treated >>> @@ -85,10 +112,18 @@ >>> * >>> * EXPECT_* and ASSERT_* are valid in a TEST() { } context. >>> */ >>> -/* Defines the test function and creates the registration stub. */ >>> #define TEST(test_name) __TEST_IMPL(test_name, -1) >>> =20 >>> -/* TEST_SIGNAL(name, signal) { implementation } >>> +/** >>> + * TEST_SIGNAL(test_name, signal) >>> + * >>> + * @test_name: test name >>> + * @signal: signal number >>> + * >>> + * .. code-block:: c >>> + * >>> + * TEST_SIGNAL(name, signal) { implementation } >>> + * >>> * Defines a test by name and the expected term signal. >>> * Names must be unique and tests must not be run in parallel. The >>> * implementation containing block is a function and scoping should = be treated >>> @@ -110,22 +145,38 @@ >>> static void test_name( \ >>> struct __test_metadata __attribute__((unused)) *_metadata) >>> =20 >>> -/* FIXTURE_DATA(datatype name) >>> +/** >>> + * FIXTURE_DATA(datatype_name) - Wraps the struct name so we have on= e less >>> + * argument to pass around >>> + * >>> + * @datatype_name: datatype name >>> + * >>> + * .. code-block:: c >>> + * >>> + * FIXTURE_DATA(datatype name) >>> + * >>> * This call may be used when the type of the fixture data >>> * is needed. In general, this should not be needed unless >>> - * the |self| is being passed to a helper directly. >>> + * the *self* is being passed to a helper directly. >>> */ >>> -/* Wraps the struct name so we have one less argument to pass around= =2E */ >>> #define FIXTURE_DATA(datatype_name) struct _test_data_##datatype_nam= e >>> =20 >>> -/* FIXTURE(datatype name) { >>> - * type property1; >>> - * ... >>> - * }; >>> - * Defines the data provided to TEST_F()-defined tests as |self|. I= t should be >>> - * populated and cleaned up using FIXTURE_SETUP and FIXTURE_TEARDOWN= =2E >>> +/** >>> + * FIXTURE(fixture_name) - Called once per fixture to setup the data= and >>> + * register >>> + * >>> + * @fixture_name: fixture name >>> + * >>> + * .. code-block:: c >>> + * >>> + * FIXTURE(datatype name) { >>> + * type property1; >>> + * ... >>> + * }; >>> + * >>> + * Defines the data provided to TEST_F()-defined tests as *self*. I= t should be >>> + * populated and cleaned up using FIXTURE_SETUP() and FIXTURE_TEARDO= WN(). >>> */ >>> -/* Called once per fixture to setup the data and register. */ >>> #define FIXTURE(fixture_name) \ >>> static void __attribute__((constructor)) \ >>> _register_##fixture_name##_data(void) \ >>> @@ -134,9 +185,18 @@ >>> } \ >>> FIXTURE_DATA(fixture_name) >>> =20 >>> -/* FIXTURE_SETUP(fixture name) { implementation } >>> +/** >>> + * FIXTURE_SETUP(fixture_name) - Prepares the setup function for the= fixture. >>> + * *_metadata* is included so that ASSERT_* work as a convenience >>> + * >>> + * @fixture_name: fixture name >>> + * >>> + * .. code-block:: c >>> + * >>> + * FIXTURE_SETUP(fixture name) { implementation } >>> + * >>> * Populates the required "setup" function for a fixture. An instan= ce of the >>> - * datatype defined with _FIXTURE_DATA will be exposed as |self| for= the >>> + * datatype defined with FIXTURE_DATA() will be exposed as *self* fo= r the >>> * implementation. >>> * >>> * ASSERT_* are valid for use in this context and will prempt the ex= ecution >>> @@ -144,16 +204,21 @@ >>> * >>> * A bare "return;" statement may be used to return early. >>> */ >>> -/* Prepares the setup function for the fixture. |_metadata| is incl= uded >>> - * so that ASSERT_* work as a convenience. >>> - */ >>> #define FIXTURE_SETUP(fixture_name) \ >>> void fixture_name##_setup( \ >>> struct __test_metadata __attribute__((unused)) *_metadata, \ >>> FIXTURE_DATA(fixture_name) __attribute__((unused)) *self) >>> -/* FIXTURE_TEARDOWN(fixture name) { implementation } >>> +/** >>> + * FIXTURE_TEARDOWN(fixture_name) >>> + * >>> + * @fixture_name: fixture name >>> + * >>> + * .. code-block:: c >>> + * >>> + * FIXTURE_TEARDOWN(fixture name) { implementation } >>> + * >>> * Populates the required "teardown" function for a fixture. An ins= tance of the >>> - * datatype defined with _FIXTURE_DATA will be exposed as |self| for= the >>> + * datatype defined with FIXTURE_DATA() will be exposed as *self* fo= r the >>> * implementation to clean up. >>> * >>> * A bare "return;" statement may be used to return early. >>> @@ -163,15 +228,22 @@ >>> struct __test_metadata __attribute__((unused)) *_metadata, \ >>> FIXTURE_DATA(fixture_name) __attribute__((unused)) *self) >>> =20 >>> -/* TEST_F(fixture, name) { implementation } >>> +/** >>> + * TEST_F(fixture_name, test_name) - Emits test registration and hel= pers for >>> + * fixture-based test cases >>> + * >>> + * @fixture_name: fixture name >>> + * @test_name: test name >>> + * >>> + * .. code-block:: c >>> + * >>> + * TEST_F(fixture, name) { implementation } >>> + * >>> * Defines a test that depends on a fixture (e.g., is part of a test= case). >>> - * Very similar to TEST() except that |self| is the setup instance o= f fixture's >>> + * Very similar to TEST() except that *self* is the setup instance o= f fixture's >>> * datatype exposed for use by the implementation. >>> */ >>> -/* Emits test registration and helpers for fixture-based test >>> - * cases. >>> - * TODO(wad) register fixtures on dedicated test lists. >>> - */ >>> +/* TODO(wad) register fixtures on dedicated test lists. */ >>> #define TEST_F(fixture_name, test_name) \ >>> __TEST_F_IMPL(fixture_name, test_name, -1) >>> =20 >>> @@ -210,10 +282,15 @@ >>> struct __test_metadata __attribute__((unused)) *_metadata, \ >>> FIXTURE_DATA(fixture_name) __attribute__((unused)) *self) >>> =20 >>> -/* Use once to append a main() to the test file. E.g., >>> - * TEST_HARNESS_MAIN >>> +/** >>> + * TEST_HARNESS_MAIN - Simple wrapper to run the test harness >>> + * >>> + * .. code-block:: c >>> + * >>> + * TEST_HARNESS_MAIN >>> + * >>> + * Use once to append a main() to the test file. >>> */ >>> -/* Exports a simple wrapper to run the test harness. */ >>> #define TEST_HARNESS_MAIN \ >>> static void __attribute__((constructor)) \ >>> __constructor_order_last(void) \ >>> @@ -225,79 +302,247 @@ >>> return test_harness_run(argc, argv); \ >>> } >>> =20 >>> -/* >>> - * Operators for use in TEST and TEST_F. >>> +/** >>> + * DOC: operators >>> + * >>> + * Operators for use in TEST() and TEST_F(). >>> * ASSERT_* calls will stop test execution immediately. >>> * EXPECT_* calls will emit a failure warning, note it, and continue= =2E >>> */ >>> -/* ASSERT_EQ(expected, measured): expected =3D=3D measured */ >>> + >>> +/** >>> + * ASSERT_EQ(expected, seen) >>> + * >>> + * @expected: expected value >>> + * @seen: measured value >>> + * >>> + * ASSERT_EQ(expected, measured): expected =3D=3D measured >>> + */ >>> #define ASSERT_EQ(expected, seen) \ >>> __EXPECT(expected, seen, =3D=3D, 1) >>> -/* ASSERT_NE(expected, measured): expected !=3D measured */ >>> + >>> +/** >>> + * ASSERT_NE(expected, seen) >>> + * >>> + * @expected: expected value >>> + * @seen: measured value >>> + * >>> + * ASSERT_NE(expected, measured): expected !=3D measured >>> + */ >>> #define ASSERT_NE(expected, seen) \ >>> __EXPECT(expected, seen, !=3D, 1) >>> -/* ASSERT_LT(expected, measured): expected < measured */ >>> + >>> +/** >>> + * ASSERT_LT(expected, seen) >>> + * >>> + * @expected: expected value >>> + * @seen: measured value >>> + * >>> + * ASSERT_LT(expected, measured): expected < measured >>> + */ >>> #define ASSERT_LT(expected, seen) \ >>> __EXPECT(expected, seen, <, 1) >>> -/* ASSERT_LE(expected, measured): expected <=3D measured */ >>> + >>> +/** >>> + * ASSERT_LE(expected, seen) >>> + * >>> + * @expected: expected value >>> + * @seen: measured value >>> + * >>> + * ASSERT_LE(expected, measured): expected <=3D measured >>> + */ >>> #define ASSERT_LE(expected, seen) \ >>> __EXPECT(expected, seen, <=3D, 1) >>> -/* ASSERT_GT(expected, measured): expected > measured */ >>> + >>> +/** >>> + * ASSERT_GT(expected, seen) >>> + * >>> + * @expected: expected value >>> + * @seen: measured value >>> + * >>> + * ASSERT_GT(expected, measured): expected > measured >>> + */ >>> #define ASSERT_GT(expected, seen) \ >>> __EXPECT(expected, seen, >, 1) >>> -/* ASSERT_GE(expected, measured): expected >=3D measured */ >>> + >>> +/** >>> + * ASSERT_GE(expected, seen) >>> + * >>> + * @expected: expected value >>> + * @seen: measured value >>> + * >>> + * ASSERT_GE(expected, measured): expected >=3D measured >>> + */ >>> #define ASSERT_GE(expected, seen) \ >>> __EXPECT(expected, seen, >=3D, 1) >>> -/* ASSERT_NULL(measured): NULL =3D=3D measured */ >>> + >>> +/** >>> + * ASSERT_NULL(seen) >>> + * >>> + * @seen: measured value >>> + * >>> + * ASSERT_NULL(measured): NULL =3D=3D measured >>> + */ >>> #define ASSERT_NULL(seen) \ >>> __EXPECT(NULL, seen, =3D=3D, 1) >>> =20 >>> -/* ASSERT_TRUE(measured): measured !=3D 0 */ >>> +/** >>> + * ASSERT_TRUE(seen) >>> + * >>> + * @seen: measured value >>> + * >>> + * ASSERT_TRUE(measured): measured !=3D 0 >>> + */ >>> #define ASSERT_TRUE(seen) \ >>> ASSERT_NE(0, seen) >>> -/* ASSERT_FALSE(measured): measured =3D=3D 0 */ >>> + >>> +/** >>> + * ASSERT_FALSE(seen) >>> + * >>> + * @seen: measured value >>> + * >>> + * ASSERT_FALSE(measured): measured =3D=3D 0 >>> + */ >>> #define ASSERT_FALSE(seen) \ >>> ASSERT_EQ(0, seen) >>> -/* ASSERT_STREQ(expected, measured): !strcmp(expected, measured) */ >>> + >>> +/** >>> + * ASSERT_STREQ(expected, seen) >>> + * >>> + * @expected: expected value >>> + * @seen: measured value >>> + * >>> + * ASSERT_STREQ(expected, measured): !strcmp(expected, measured) >>> + */ >>> #define ASSERT_STREQ(expected, seen) \ >>> __EXPECT_STR(expected, seen, =3D=3D, 1) >>> -/* ASSERT_STRNE(expected, measured): strcmp(expected, measured) */ >>> + >>> +/** >>> + * ASSERT_STRNE(expected, seen) >>> + * >>> + * @expected: expected value >>> + * @seen: measured value >>> + * >>> + * ASSERT_STRNE(expected, measured): strcmp(expected, measured) >>> + */ >>> #define ASSERT_STRNE(expected, seen) \ >>> __EXPECT_STR(expected, seen, !=3D, 1) >>> =20 >>> -/* EXPECT_EQ(expected, measured): expected =3D=3D measured */ >>> +/** >>> + * EXPECT_EQ(expected, seen) >>> + * >>> + * @expected: expected value >>> + * @seen: measured value >>> + * >>> + * EXPECT_EQ(expected, measured): expected =3D=3D measured >>> + */ >>> #define EXPECT_EQ(expected, seen) \ >>> __EXPECT(expected, seen, =3D=3D, 0) >>> -/* EXPECT_NE(expected, measured): expected !=3D measured */ >>> + >>> +/** >>> + * EXPECT_NE(expected, seen) >>> + * >>> + * @expected: expected value >>> + * @seen: measured value >>> + * >>> + * EXPECT_NE(expected, measured): expected !=3D measured >>> + */ >>> #define EXPECT_NE(expected, seen) \ >>> __EXPECT(expected, seen, !=3D, 0) >>> -/* EXPECT_LT(expected, measured): expected < measured */ >>> + >>> +/** >>> + * EXPECT_LT(expected, seen) >>> + * >>> + * @expected: expected value >>> + * @seen: measured value >>> + * >>> + * EXPECT_LT(expected, measured): expected < measured >>> + */ >>> #define EXPECT_LT(expected, seen) \ >>> __EXPECT(expected, seen, <, 0) >>> -/* EXPECT_LE(expected, measured): expected <=3D measured */ >>> + >>> +/** >>> + * EXPECT_LE(expected, seen) >>> + * >>> + * @expected: expected value >>> + * @seen: measured value >>> + * >>> + * EXPECT_LE(expected, measured): expected <=3D measured >>> + */ >>> #define EXPECT_LE(expected, seen) \ >>> __EXPECT(expected, seen, <=3D, 0) >>> -/* EXPECT_GT(expected, measured): expected > measured */ >>> + >>> +/** >>> + * EXPECT_GT(expected, seen) >>> + * >>> + * @expected: expected value >>> + * @seen: measured value >>> + * >>> + * EXPECT_GT(expected, measured): expected > measured >>> + */ >>> #define EXPECT_GT(expected, seen) \ >>> __EXPECT(expected, seen, >, 0) >>> -/* EXPECT_GE(expected, measured): expected >=3D measured */ >>> + >>> +/** >>> + * EXPECT_GE(expected, seen) >>> + * >>> + * @expected: expected value >>> + * @seen: measured value >>> + * >>> + * EXPECT_GE(expected, measured): expected >=3D measured >>> + */ >>> #define EXPECT_GE(expected, seen) \ >>> __EXPECT(expected, seen, >=3D, 0) >>> =20 >>> -/* EXPECT_NULL(measured): NULL =3D=3D measured */ >>> +/** >>> + * EXPECT_NULL(seen) >>> + * >>> + * @seen: measured value >>> + * >>> + * EXPECT_NULL(measured): NULL =3D=3D measured >>> + */ >>> #define EXPECT_NULL(seen) \ >>> __EXPECT(NULL, seen, =3D=3D, 0) >>> -/* EXPECT_TRUE(measured): 0 !=3D measured */ >>> + >>> +/** >>> + * EXPECT_TRUE(seen) >>> + * >>> + * @seen: measured value >>> + * >>> + * EXPECT_TRUE(measured): 0 !=3D measured >>> + */ >>> #define EXPECT_TRUE(seen) \ >>> EXPECT_NE(0, seen) >>> -/* EXPECT_FALSE(measured): 0 =3D=3D measured */ >>> + >>> +/** >>> + * EXPECT_FALSE(seen) >>> + * >>> + * @seen: measured value >>> + * >>> + * EXPECT_FALSE(measured): 0 =3D=3D measured >>> + */ >>> #define EXPECT_FALSE(seen) \ >>> EXPECT_EQ(0, seen) >>> =20 >>> -/* EXPECT_STREQ(expected, measured): !strcmp(expected, measured) */ >>> +/** >>> + * EXPECT_STREQ(expected, seen) >>> + * >>> + * @expected: expected value >>> + * @seen: measured value >>> + * >>> + * EXPECT_STREQ(expected, measured): !strcmp(expected, measured) >>> + */ >>> #define EXPECT_STREQ(expected, seen) \ >>> __EXPECT_STR(expected, seen, =3D=3D, 0) >>> -/* EXPECT_STRNE(expected, measured): strcmp(expected, measured) */ >>> + >>> +/** >>> + * EXPECT_STRNE(expected, seen) >>> + * >>> + * @expected: expected value >>> + * @seen: measured value >>> + * >>> + * EXPECT_STRNE(expected, measured): strcmp(expected, measured) >>> + */ >>> #define EXPECT_STRNE(expected, seen) \ >>> __EXPECT_STR(expected, seen, !=3D, 0) >>> =20 >>> >> >> >=20 --LM8wMi28qjLae66jsO5HnxFIgaNaXnw3a-- --Uw3RVnRlVTVeSlvnihDCLk78iO4DOegpL Content-Type: application/pgp-signature; name="signature.asc" Content-Description: OpenPGP digital signature Content-Disposition: attachment; filename="signature.asc" -----BEGIN PGP SIGNATURE----- iQIcBAEBCAAGBQJZNaDrAAoJEAsCRMQNDUMc+MIP/io53vSXd2NBVbhzDWHXX4Ui LKUEb8mpKbwcSUdSl8tkzh/RuAkjkt4vTpyQrUdi+pWQu0peXLW+J9GZ49BsQZng EhU+J5Kgryj/vO4qxgSwJXxZX4IGEnELCsS5gwUl2XW9Ml+wWzXRpBX3OoDYZqCi Ue36WGFLaPOTjSHxpsL5zjhwX7VeWS8kYNm0J4e7Er+EoUI8qR6U6DL7bMzQw9hG 5Z1Luw8K0kHUvIvQ7n/SzzlXX1GI60neEJcpVsYPoPUBu1BzIeO5MbDXmqtSYkS6 UMezcjZWi0U7GzE1aS97FrG8vTF4ly3thjbGqIRK64w+iBP2Qv0zQbxj2ofrP/2f SJ8PuoPQ0sHFzU5o8LWDAZcJTq/JBsxn0rkLbJ89m2IJL1+QDxJ/3PlmR1v8KREY hRTRH6yP0IWWIUxECGoe2602bGLeQriFyUOlg+rzSf3bfVGdJjLtwkxBh4Os9P3s Tv8uY43nsyaRzltFvYcJ2o3FUh8V+u7bVgwtiitkm4SduxctK6LYtyzJ2CUagmbS pi35WZOcRUuKpbl+OTUg6GqAI0RfAijlsNOKuY42ICsBT6sMv+05xiD6P9dHJ6fG IlQhzmcSU8v6cTzV3uVRc4QgJj+/BlBgz0LjCEpaO1bSE9TNWSsEeXDCAvhDkixK AcjBStfnD+lrn1uc7a97 =NPYM -----END PGP SIGNATURE----- --Uw3RVnRlVTVeSlvnihDCLk78iO4DOegpL--