Imported Upstream version 0.8.4
[platform/upstream/multipath-tools.git] / tests / test-log.c
1 #include <setjmp.h>
2 #include <stddef.h>
3 #include <stdarg.h>
4 #include <stdio.h>
5 #include <cmocka.h>
6 #include "log.h"
7 #include "test-log.h"
8
9 __attribute__((format(printf, 3, 0)))
10 void __wrap_dlog (int sink, int prio, const char * fmt, ...)
11 {
12         char buff[MAX_MSG_SIZE];
13         va_list ap;
14
15         assert_int_equal(prio, mock_type(int));
16         va_start(ap, fmt);
17         vsnprintf(buff, MAX_MSG_SIZE, fmt, ap);
18         va_end(ap);
19         assert_string_equal(buff, mock_ptr_type(char *));
20 }
21
22 void expect_condlog(int prio, char *string)
23 {
24         will_return(__wrap_dlog, prio);
25         will_return(__wrap_dlog, string);
26 }
27