[dm-devel] [PATCH 03/35] tests: __wrap_dlog: use check_expected()

mwilck at suse.com mwilck at suse.com
Thu Jul 9 10:15:48 UTC 2020


From: Martin Wilck <mwilck at suse.com>

For function parameters, cmocka's check_expected() API should be used
rather than will_return() / mock_type().

Signed-off-by: Martin Wilck <mwilck at suse.com>
---
 tests/test-log.c | 5 ++---
 1 file changed, 2 insertions(+), 3 deletions(-)

diff --git a/tests/test-log.c b/tests/test-log.c
index d685d58..051491e 100644
--- a/tests/test-log.c
+++ b/tests/test-log.c
@@ -12,7 +12,7 @@ void __wrap_dlog (int sink, int prio, const char * fmt, ...)
 	char buff[MAX_MSG_SIZE];
 	va_list ap;
 
-	assert_int_equal(prio, mock_type(int));
+	check_expected(prio);
 	va_start(ap, fmt);
 	vsnprintf(buff, MAX_MSG_SIZE, fmt, ap);
 	va_end(ap);
@@ -21,7 +21,6 @@ void __wrap_dlog (int sink, int prio, const char * fmt, ...)
 
 void expect_condlog(int prio, char *string)
 {
-	will_return(__wrap_dlog, prio);
+	expect_value(__wrap_dlog, prio, prio);
 	will_return(__wrap_dlog, string);
 }
-
-- 
2.26.2





More information about the dm-devel mailing list