summaryrefslogtreecommitdiff
path: root/src/tests/eo/suite/eo_error_msgs.h
blob: 56819040c06b4ee364b87c55c9a79361443913d2 (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
#ifndef _EO_ERROR_MSGS_H
#define _EO_ERROR_MSGS_H

#include "Eo.h"
#include "eo_suite.h"

/* The Max level to consider when working with the print cb. */
#define _EINA_LOG_MAX 2
/* #define SHOW_LOG 1 */

struct log_ctx {
   const char *msg;
   const char *fnc;
   Eina_Bool did;
   int expected_level;
};

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);

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);

#define TEST_EO_ERROR(fn, _msg)                  \
  ctx.msg = _msg;                                \
  ctx.fnc = fn;                                  \
  ctx.did = EINA_FALSE;                          \
  ctx.expected_level = EINA_LOG_LEVEL_ERR

#define TEST_EO_CRITICAL(fn, _msg)               \
  ctx.msg = _msg;                                \
  ctx.fnc = fn;                                  \
  ctx.did = EINA_FALSE;                          \
  ctx.expected_level = EINA_LOG_LEVEL_CRITICAL

#endif /* _EO_ERROR_MSGS_H */