summaryrefslogtreecommitdiff
path: root/src/tests/eo/suite/eo_error_msgs.c
blob: bd187d3f971baf7f7b6f7045ae5dfe172f8b69ad (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
#include "eo_error_msgs.h"

void
eo_test_print_cb(const Eina_Log_Domain *d, Eina_Log_Level level, const char *file, const char *fnc, int line, const char *fmt, void *data, va_list args EINA_UNUSED)
{
   struct log_ctx *myctx = data;

   if (level > _EINA_LOG_MAX)
      return;

#ifdef SHOW_LOG
   eina_log_print_cb_stderr(d, level, file, fnc, line, fmt, NULL, args);
#else
   (void)d;
   (void)file;
   (void)line;
#endif

   ck_assert_int_eq(level, myctx->expected_level);
   if (myctx->msg)
      ck_assert_str_eq(myctx->msg, fmt);
   ck_assert_str_eq(myctx->fnc, fnc);
   myctx->did = EINA_TRUE;
}

void
eo_test_safety_print_cb(const Eina_Log_Domain *d, Eina_Log_Level level, const char *file, const char *fnc, int line, const char *fmt, void *data, va_list args EINA_UNUSED)
{
   struct log_ctx *myctx = data;
   va_list cp_args;
   const char *str;

   if (level > _EINA_LOG_MAX)
     return;

#ifdef SHOW_LOG
   eina_log_print_cb_stderr(d, level, file, fnc, line, fmt, NULL, args);
#else
   (void)d;
   (void)file;
   (void)line;
#endif

   va_copy(cp_args, args);
   str = va_arg(cp_args, const char *);
   va_end(cp_args);

   ck_assert_int_eq(level, myctx->expected_level);
   ck_assert_str_eq(fmt, "%s");
   ck_assert_str_eq(myctx->msg, str);
   ck_assert_str_eq(myctx->fnc, fnc);
   myctx->did = EINA_TRUE;
}