]> granicus.if.org Git - check/commitdiff
* Support 64bit int for __ck_assert_int. Patch from bug #3599471
authorhugo303 <hugo303@64e312b2-a51f-0410-8e61-82d0ca0eb02a>
Fri, 8 Feb 2013 14:23:01 +0000 (14:23 +0000)
committerhugo303 <hugo303@64e312b2-a51f-0410-8e61-82d0ca0eb02a>
Fri, 8 Feb 2013 14:23:01 +0000 (14:23 +0000)
git-svn-id: svn+ssh://svn.code.sf.net/p/check/code/trunk@694 64e312b2-a51f-0410-8e61-82d0ca0eb02a

configure.ac
doc/check.texi
src/check.h.in

index f1a5682c843800123491c2bcb4bde152e4c3baf7..152c8084e275f7e4da4bfef0f36bc3de08435391 100644 (file)
@@ -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
index b55151e55a592506f4da00a1f78a1cbe196de3c1..4c1a688d7f97f4de23142ce30a5a2c5abbeb176c 100644 (file)
@@ -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.
index 551ca55717fc797e29e886e8399a9ecea2c7f03a..7e9c520d13ce0b1ee644ff0bde0ffc4d0189b9d2 100644 (file)
 #ifndef CHECK_H
 #define CHECK_H
 
+#if HAVE_CONFIG_H
+#include <config.h>
+#endif
+
 #include <stddef.h>
 #include <string.h>
+#ifdef HAVE_STDINT_H
+#include <stdint.h>
+#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)