Skip to content

Commit

Permalink
tests: Rework some libCheck macros
Browse files Browse the repository at this point in the history
Signed-off-by: Ben Collins <[email protected]>
  • Loading branch information
benmcollins committed Dec 24, 2024
1 parent e116d28 commit 41efbf5
Show file tree
Hide file tree
Showing 3 changed files with 4 additions and 14 deletions.
2 changes: 1 addition & 1 deletion CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -52,7 +52,7 @@ if (WITH_OPENSSL)
endif()

# Tests and coverage depend on this, but optional
pkg_check_modules(CHECK check>=0.9.4)
pkg_check_modules(CHECK check>=0.9.10)

add_library(jwt SHARED)
add_library(jwt_static STATIC)
Expand Down
2 changes: 1 addition & 1 deletion configure.ac
Original file line number Diff line number Diff line change
Expand Up @@ -107,7 +107,7 @@ AC_ARG_WITH([examples],
[AM_CONDITIONAL([BUILD_EXAMPLES],[false])])

PKG_CHECK_MODULES([JANSSON], [jansson >= 2.0])
PKG_CHECK_MODULES([CHECK], [check >= 0.9.4],
PKG_CHECK_MODULES([CHECK], [check >= 0.9.10],
[RPMB_CHECK="--with check"],[RPMB_CHECK="--without check"])

AC_SUBST([RPMBUILD_OPTS],["$RPMB_OPENSSL $RPMB_GNUTLS $RPMB_CHECK"])
Expand Down
14 changes: 2 additions & 12 deletions tests/jwt_tests.h
Original file line number Diff line number Diff line change
Expand Up @@ -20,19 +20,9 @@
#endif

/* Compatibility with older libCheck versions */
#ifndef ck_assert_ptr_ne
#define ck_assert_ptr_ne(__X, __Y) ck_assert(__X != __Y)
#define ck_assert_ptr_eq(__X, __Y) ck_assert(__X == __Y)
#endif

#ifndef ck_assert_int_gt
#define ck_assert_int_gt(__X, __Y) ck_assert(__X > __Y)
#define ck_assert_int_lt(__X, __Y) ck_assert(__X < __Y)
#endif

#ifndef ck_assert_ptr_null
#define ck_assert_ptr_null(__X) ck_assert(__X == NULL)
#define ck_assert_ptr_nonnull(__X) ck_assert(__X != NULL)
#define ck_assert_ptr_null(__X) ck_assert_ptr_eq(__X, NULL)
#define ck_assert_ptr_nonnull(__X) ck_assert_ptr_ne(__X, NULL)
#endif

/* Constant time to make tests consistent. */
Expand Down

0 comments on commit 41efbf5

Please sign in to comment.