Add new macro will_return_always
authorPavel Březina <pbrezina@redhat.com>
Thu, 18 Jul 2013 11:19:08 +0000 (13:19 +0200)
committerAndreas Schneider <asn@cryptomilk.org>
Thu, 18 Jul 2013 12:33:47 +0000 (14:33 +0200)
Signed-off-by: Pavel Březina <pbrezina@redhat.com>
Reviewed-by: Andreas Schneider <asn@cryptomilk.org>
include/cmocka.h

index 02757ef..1255bbe 100644 (file)
@@ -291,6 +291,28 @@ void will_return_count(#function, void *value, int count);
                  cast_to_largest_integral_type(value), count)
 #endif
 
+#ifdef DOXYGEN
+/**
+ * @brief Store a value that will be always returned by mock().
+ *
+ * @param[in]  #function  The function which should return the given value.
+ *
+ * @param[in]  value The value to be returned by mock().
+ *
+ * This is equivalent to:
+ * @code
+ * will_return_count(function, value, -1);
+ * @endcode
+ *
+ * @see will_return_count()
+ * @see mock()
+ */
+void will_return_always(#function, void *value);
+#else
+#define will_return_always(function, value) \
+    will_return_count(#function, (value), -1)
+#endif
+
 /** @} */
 
 /**