From 9b74b6390219f477f4da30777390891115c2beb2 Mon Sep 17 00:00:00 2001 From: hugo303 Date: Fri, 8 Feb 2013 14:23:01 +0000 Subject: [PATCH] * Support 64bit int for __ck_assert_int. Patch from bug #3599471 git-svn-id: svn+ssh://svn.code.sf.net/p/check/code/trunk@694 64e312b2-a51f-0410-8e61-82d0ca0eb02a --- configure.ac | 1 + doc/check.texi | 8 ++++---- src/check.h.in | 17 ++++++++++++----- 3 files changed, 17 insertions(+), 9 deletions(-) diff --git a/configure.ac b/configure.ac index f1a5682..152c808 100644 --- a/configure.ac +++ b/configure.ac @@ -167,6 +167,7 @@ AM_CONDITIONAL(SUBUNIT, test x"$enable_subunit" != "xfalse") AC_C_CONST AC_TYPE_PID_T AC_TYPE_SIZE_T +AC_TYPE_INTMAX_T AC_TYPE_UINT32_T AC_HEADER_TIME AC_STRUCT_TM diff --git a/doc/check.texi b/doc/check.texi index b55151e..4c1a688 100644 --- a/doc/check.texi +++ b/doc/check.texi @@ -860,10 +860,10 @@ provided message. @itemx ck_assert_int_gt @itemx ck_assert_int_ge -Compares two @code{int} values and displays predefined message with -condition and values of both input parameters on failure. The operator -used for comparison is different for each function and is indicated by -the last two letters of the function name. The abbreviations @code{eq}, +Compares two signed integer values (@code{intmax_t}) and displays predefined +message with condition and values of both input parameters on failure. The +operator used for comparison is different for each function and is indicated +by the last two letters of the function name. The abbreviations @code{eq}, @code{ne}, @code{lt}, @code{le}, @code{gt}, and @code{ge} correspond to @code{==}, @code{!=}, @code{<}, @code{<=}, @code{>}, and @code{>=} respectively. diff --git a/src/check.h.in b/src/check.h.in index 551ca55..7e9c520 100644 --- a/src/check.h.in +++ b/src/check.h.in @@ -22,8 +22,15 @@ #ifndef CHECK_H #define CHECK_H +#if HAVE_CONFIG_H +#include +#endif + #include #include +#ifdef HAVE_STDINT_H +#include +#endif /* Check: a unit test framework for C @@ -278,12 +285,12 @@ void CK_EXPORT _ck_assert_msg (int result, const char *file, /* Integer comparsion macros with improved output compared to ck_assert(). */ /* OP may be any comparion operator. */ #define _ck_assert_int(X, OP, Y) do { \ - int _ck_x = (X); \ - int _ck_y = (Y); \ - ck_assert_msg(_ck_x OP _ck_y, "Assertion '"#X#OP#Y"' failed: "#X"==%d, "#Y"==%d", _ck_x, _ck_y); \ + intmax_t _ck_x = (X); \ + intmax_t _ck_y = (Y); \ + ck_assert_msg(_ck_x OP _ck_y, "Assertion '"#X#OP#Y"' failed: "#X"==%jd, "#Y"==%jd", _ck_x, _ck_y); \ } while (0) -#define ck_assert_int_eq(X, Y) _ck_assert_int(X, ==, Y) -#define ck_assert_int_ne(X, Y) _ck_assert_int(X, !=, Y) +#define ck_assert_int_eq(X, Y) _ck_assert_int(X, ==, Y) +#define ck_assert_int_ne(X, Y) _ck_assert_int(X, !=, Y) #define ck_assert_int_lt(X, Y) _ck_assert_int(X, <, Y) #define ck_assert_int_le(X, Y) _ck_assert_int(X, <=, Y) #define ck_assert_int_gt(X, Y) _ck_assert_int(X, >, Y) -- 2.40.0