From: Tobias Brunner Date: Tue, 2 Apr 2019 14:22:21 +0000 (+0200) Subject: unit-tests: Add macros to assert certain payloads are (not) in a message X-Git-Tag: 5.8.0rc1~24^2~4 X-Git-Url: http://git.ipfire.org/gitweb/gitweb.cgi?a=commitdiff_plain;h=202fb101b8aed4b8153f638580177163665b3faa;p=thirdparty%2Fstrongswan.git unit-tests: Add macros to assert certain payloads are (not) in a message --- diff --git a/src/libcharon/tests/utils/exchange_test_asserts.h b/src/libcharon/tests/utils/exchange_test_asserts.h index ae9ac5c982..beb8cfd955 100644 --- a/src/libcharon/tests/utils/exchange_test_asserts.h +++ b/src/libcharon/tests/utils/exchange_test_asserts.h @@ -297,6 +297,26 @@ bool exchange_test_asserts_message(listener_t *this, ike_sa_t *ike_sa, #define assert_single_payload(dir, expected) \ _assert_payload(#dir, 1, { TRUE, expected, 0 }) +/** + * Assert that the next in- or outbound plaintext message contains a payload + * of the given type. + * + * @param dir IN or OUT to check the next in- or outbound message + * @param expected expected payload type + */ +#define assert_payload(dir, expected) \ + _assert_payload(#dir, -1, { TRUE, expected, 0 }) + +/** + * Assert that the next in- or outbound plaintext message contains no payload + * of the given type. + * + * @param dir IN or OUT to check the next in- or outbound message + * @param unexpected not expected payload type + */ +#define assert_no_payload(dir, unexpected) \ + _assert_payload(#dir, -1, { FALSE, unexpected, 0 }) + /** * Assert that the next in- or outbound plaintext message contains exactly * one notify of the given type.