summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAndreas Schneider <asn@cryptomilk.org>2015-02-20 08:48:36 (GMT)
committerAndreas Schneider <asn@cryptomilk.org>2015-02-20 14:10:41 (GMT)
commitd7ab572b7db2a139fe68506747c3effb7b960114 (patch)
tree2bec0a24effe535398574bf00dc13c5172c12f1b
parent5d5fb5afc3811f9f56e69ce5acb4614e32a7c969 (diff)
downloadcmocka-d7ab572b7db2a139fe68506747c3effb7b960114.zip
cmocka-d7ab572b7db2a139fe68506747c3effb7b960114.tar.gz
cmocka-d7ab572b7db2a139fe68506747c3effb7b960114.tar.bz2
include: Add macro for assert_ptr_equal().
Signed-off-by: Andreas Schneider <asn@cryptomilk.org>
-rw-r--r--include/cmocka.h38
1 files changed, 38 insertions, 0 deletions
diff --git a/include/cmocka.h b/include/cmocka.h
index 43336e8..35100d0 100644
--- a/include/cmocka.h
+++ b/include/cmocka.h
@@ -1093,6 +1093,44 @@ __FILE__, __LINE__)
#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.
*
* The function prints an error message to standard error and terminates the