include: Add macro for assert_ptr_equal().
authorAndreas Schneider <asn@cryptomilk.org>
Fri, 20 Feb 2015 08:48:36 +0000 (09:48 +0100)
committerAndreas Schneider <asn@cryptomilk.org>
Fri, 20 Feb 2015 14:10:41 +0000 (15:10 +0100)
Signed-off-by: Andreas Schneider <asn@cryptomilk.org>
include/cmocka.h

index 43336e8350e3a84f0fd0cc68c75aefd95f2244a6..35100d0223fc0a6f579a6eec9834e2883ca8fedc 100644 (file)
@@ -1091,6 +1091,44 @@ void assert_null(void *pointer);
 __FILE__, __LINE__)
 #endif
 
+#ifdef DOXYGEN
+/**
+ * @brief Assert that the two given pointers are equal.
+ *
+ * The function prints an error message and terminates the test by calling
+ * fail() if the pointers are not equal.
+ *
+ * @param[in]  a        The first pointer to compare.
+ *
+ * @param[in]  b        The pointer to compare against the first one.
+ */
+void assert_ptr_equal(void *a, void *b);
+#else
+#define assert_ptr_equal(a, b) \
+    _assert_int_equal(cast_ptr_to_largest_integral_type(a), \
+                      cast_ptr_to_largest_integral_type(b), \
+                      __FILE__, __LINE__)
+#endif
+
+#ifdef DOXYGEN
+/**
+ * @brief Assert that the two given pointers are not equal.
+ *
+ * The function prints an error message and terminates the test by calling
+ * fail() if the pointers are equal.
+ *
+ * @param[in]  a        The first pointer to compare.
+ *
+ * @param[in]  b        The pointer to compare against the first one.
+ */
+void assert_ptr_not_equal(void *a, void *b);
+#else
+#define assert_ptr_not_equal(a, b) \
+    _assert_int_not_equal(cast_ptr_to_largest_integral_type(a), \
+                          cast_ptr_to_largest_integral_type(b), \
+                          __FILE__, __LINE__)
+#endif
+
 #ifdef DOXYGEN
 /**
  * @brief Assert that the two given integers are equal.