Blog
Community
Development
Documentation
CNDP
22.08.0
Main Page
Related Pages
Data Structures
Data Structures
Data Fields
All
_
a
b
c
d
e
f
g
h
i
j
k
l
m
n
o
p
q
r
s
t
u
v
w
Functions
Variables
_
a
b
c
d
e
f
g
h
i
k
l
m
n
o
p
q
r
s
t
u
v
w
Files
File List
Globals
All
_
a
b
c
d
e
f
g
h
i
j
k
l
m
n
o
p
r
s
t
u
v
x
Functions
_
c
d
e
f
g
h
i
j
k
l
m
n
p
s
t
u
v
x
Variables
Typedefs
a
b
c
h
i
j
l
m
o
p
s
t
u
v
Enumerations
Enumerator
_
a
c
d
e
j
m
p
r
s
t
u
Macros
_
a
c
d
e
h
i
j
k
l
m
o
p
r
t
u
v
x
Examples
•
All
Data Structures
Files
Functions
Variables
Typedefs
Enumerations
Enumerator
Macros
Pages
cne_test.h
1
/* SPDX-License-Identifier: BSD-3-Clause
2
* Copyright (c) 2015 Cavium, Inc
3
* Copyright (c) 2019-2022 Intel Corporation
4
*/
5
6
#ifndef _CNE_TEST_H_
7
#define _CNE_TEST_H_
8
9
#include <
cne_log.h
>
10
11
#ifdef __cplusplus
12
extern
"C"
{
13
#endif
14
15
/* Before including cne_test.h file you can define
16
* CNE_TEST_TRACE_FAILURE(_file, _line, _func) macro to better trace/debug test
17
* failures. Mostly useful in development phase.
18
*/
19
#ifndef CNE_TEST_TRACE_FAILURE
20
#define CNE_TEST_TRACE_FAILURE(_file, _line, _func)
21
#endif
22
26
#define CNE_TEST_ASSERT(cond, msg, ...) \
27
do { \
28
if (!(cond)) { \
29
CNE_ERR("Test assert %s line %d failed: "
msg "\n", __func__, __LINE__, \
30
##__VA_ARGS__); \
31
CNE_TEST_TRACE_FAILURE(__FILE__, __LINE__, __func__); \
32
return -1; \
33
} \
34
} while (0)
35
46
#define CNE_TEST_ASSERT_EQUAL(a, b, msg, ...) CNE_TEST_ASSERT(a == b, msg, ##__VA_ARGS__)
47
58
#define CNE_TEST_ASSERT_NOT_EQUAL(a, b, msg, ...) CNE_TEST_ASSERT(a != b, msg, ##__VA_ARGS__)
59
68
#define CNE_TEST_ASSERT_SUCCESS(val, msg, ...) CNE_TEST_ASSERT(val == 0, msg, ##__VA_ARGS__)
69
78
#define CNE_TEST_ASSERT_FAIL(val, msg, ...) CNE_TEST_ASSERT(val != 0, msg, ##__VA_ARGS__)
79
88
#define CNE_TEST_ASSERT_NULL(val, msg, ...) CNE_TEST_ASSERT(val == NULL, msg, ##__VA_ARGS__)
89
98
#define CNE_TEST_ASSERT_NOT_NULL(val, msg, ...) CNE_TEST_ASSERT(val != NULL, msg, ##__VA_ARGS__)
99
100
#ifdef __cplusplus
101
}
102
#endif
103
104
#endif
/* _CNE_TEST_H_ */
cne_log.h
lib
include
cne_test.h
Generated by
1.9.1