Create ASSERT_{EQ, NE, TRUE, FALSE} macros to make test creation easier. Signed-off-by: André Almeida <andrealm...@igalia.com> --- .../testing/selftests/futex/include/logging.h | 28 +++++++++++++++++++ 1 file changed, 28 insertions(+)
diff --git a/tools/testing/selftests/futex/include/logging.h b/tools/testing/selftests/futex/include/logging.h index 874c69ce5cce..a7070e7cf313 100644 --- a/tools/testing/selftests/futex/include/logging.h +++ b/tools/testing/selftests/futex/include/logging.h @@ -23,6 +23,34 @@ #include <linux/futex.h> #include "kselftest.h" +#define ASSERT_EQ(var, value) \ + if (var != value) { \ + ksft_test_result_fail("%s: expected %ld, but %s has %ld\n", \ + __func__, (long int) value, #var, (long int) var); \ + return; \ + } + +#define ASSERT_NE(var, value) \ + if (var == value) { \ + ksft_test_result_fail("%s: expected not %ld, but %s has %ld\n", \ + __func__, (long int) value, #var, (long int) var); \ + return; \ + } + +#define ASSERT_TRUE(var) \ + if ((var) == 0) { \ + ksft_test_result_fail("%s: expected %s to be true\n", \ + __func__, #var); \ + return; \ + } + +#define ASSERT_FALSE(var) \ + if (var) { \ + ksft_test_result_fail("%s: expected %s to be false\n", \ + __func__, #var); \ + return; \ + } + /* * Define PASS, ERROR, and FAIL strings with and without color escape * sequences, default to no color. -- 2.46.0