Data Accelerator Offload
Loading...
Searching...
No Matches
Macros
dao_assert.h File Reference
#include <dao_log.h>

Go to the source code of this file.

Macros

#define DAO_ASSERT(cond, msg, ...)
 
#define DAO_ASSERT_FATAL(cond, msg, ...)
 
#define DAO_ASSERT_EQUAL(a, b, msg, ...)   DAO_ASSERT((a) == (b), msg, ##__VA_ARGS__)
 
#define DAO_ASSERT_EQUAL_FATAL(a, b, msg, ...)   DAO_ASSERT_FATAL((a) == (b), msg, ##__VA_ARGS__)
 
#define DAO_ASSERT_NOT_EQUAL(a, b, msg, ...)   DAO_ASSERT((a) != (b), msg, ##__VA_ARGS__)
 
#define DAO_ASSERT_NOT_EQUAL_FATAL(a, b, msg, ...)   DAO_ASSERT_FATAL((a) != (b), msg, ##__VA_ARGS__)
 
#define DAO_ASSERT_SUCCESS(val, msg, ...)   DAO_ASSERT((val) == 0, msg, ##__VA_ARGS__)
 
#define DAO_ASSERT_SUCCESS_FATAL(val, msg, ...)   DAO_ASSERT_FATAL((val) == 0, msg, ##__VA_ARGS__)
 
#define DAO_ASSERT_FAIL(val, msg, ...)   DAO_ASSERT((val) != 0, msg, ##__VA_ARGS__)
 
#define DAO_ASSERT_FAIL_FATAL(val, msg, ...)   DAO_ASSERT_FATAL((val) != 0, msg, ##__VA_ARGS__)
 
#define DAO_ASSERT_ZERO(val, msg, ...)   DAO_ASSERT((val) == 0, msg, ##__VA_ARGS__)
 
#define DAO_ASSERT_ZERO_FATAL(val, msg, ...)   DAO_ASSERT_FATAL((val) == 0, msg, ##__VA_ARGS__)
 
#define DAO_ASSERT_NOT_ZERO(val, msg, ...)   DAO_ASSERT((val) != 0, msg, ##__VA_ARGS__)
 
#define DAO_ASSERT_NOT_ZERO_FATAL(val, msg, ...)   DAO_ASSERT_FATAL((val) != 0, msg, ##__VA_ARGS__)
 
#define DAO_ASSERT_NULL(val, msg, ...)   DAO_ASSERT((val) == NULL, msg, ##__VA_ARGS__)
 
#define DAO_ASSERT_NULL_FATAL(val, msg, ...)   DAO_ASSERT_FATAL((val) == NULL, msg, ##__VA_ARGS__)
 
#define DAO_ASSERT_NOT_NULL(val, msg, ...)   DAO_ASSERT((val) != NULL, msg, ##__VA_ARGS__)
 
#define DAO_ASSERT_NOT_NULL_FATAL(val, msg, ...)   DAO_ASSERT_FATAL((val) != NULL, msg, ##__VA_ARGS__)
 

Detailed Description

Defining macros for assertions in user test cases.

Definition in file dao_assert.h.

Macro Definition Documentation

◆ DAO_ASSERT

#define DAO_ASSERT (   cond,
  msg,
  ... 
)
Value:
do { \
if (!(cond)) { \
dao_err("Test assert %s line %d failed: " msg "\n", __func__, __LINE__, \
##__VA_ARGS__); \
} \
} while (0)

Normal assertion. Reports failure with no other action.

Definition at line 18 of file dao_assert.h.

◆ DAO_ASSERT_FATAL

#define DAO_ASSERT_FATAL (   cond,
  msg,
  ... 
)
Value:
do { \
if (!(cond)) { \
dao_exit("Test assert %s line %d failed: " msg "\n", __func__, __LINE__, \
##__VA_ARGS__); \
} \
} while (0)

Fatal assertion Reports failure and causes test to abort.

Definition at line 29 of file dao_assert.h.

◆ DAO_ASSERT_EQUAL

#define DAO_ASSERT_EQUAL (   a,
  b,
  msg,
  ... 
)    DAO_ASSERT((a) == (b), msg, ##__VA_ARGS__)

Asserts that a == b

Definition at line 40 of file dao_assert.h.

◆ DAO_ASSERT_EQUAL_FATAL

#define DAO_ASSERT_EQUAL_FATAL (   a,
  b,
  msg,
  ... 
)    DAO_ASSERT_FATAL((a) == (b), msg, ##__VA_ARGS__)

Asserts that a == b Reports failure and causes test to abort.

Definition at line 46 of file dao_assert.h.

◆ DAO_ASSERT_NOT_EQUAL

#define DAO_ASSERT_NOT_EQUAL (   a,
  b,
  msg,
  ... 
)    DAO_ASSERT((a) != (b), msg, ##__VA_ARGS__)

Asserts that a != b

Definition at line 51 of file dao_assert.h.

◆ DAO_ASSERT_NOT_EQUAL_FATAL

#define DAO_ASSERT_NOT_EQUAL_FATAL (   a,
  b,
  msg,
  ... 
)    DAO_ASSERT_FATAL((a) != (b), msg, ##__VA_ARGS__)

Asserts that a != b Reports failure and causes test to abort.

Definition at line 57 of file dao_assert.h.

◆ DAO_ASSERT_SUCCESS

#define DAO_ASSERT_SUCCESS (   val,
  msg,
  ... 
)    DAO_ASSERT((val) == 0, msg, ##__VA_ARGS__)

Asserts that val == 0

Definition at line 62 of file dao_assert.h.

◆ DAO_ASSERT_SUCCESS_FATAL

#define DAO_ASSERT_SUCCESS_FATAL (   val,
  msg,
  ... 
)    DAO_ASSERT_FATAL((val) == 0, msg, ##__VA_ARGS__)

Asserts that val == 0 Reports failure and causes test to abort.

Definition at line 68 of file dao_assert.h.

◆ DAO_ASSERT_FAIL

#define DAO_ASSERT_FAIL (   val,
  msg,
  ... 
)    DAO_ASSERT((val) != 0, msg, ##__VA_ARGS__)

Asserts that val != 0

Definition at line 73 of file dao_assert.h.

◆ DAO_ASSERT_FAIL_FATAL

#define DAO_ASSERT_FAIL_FATAL (   val,
  msg,
  ... 
)    DAO_ASSERT_FATAL((val) != 0, msg, ##__VA_ARGS__)

Asserts that val != 0 Reports failure and causes test to abort.

Definition at line 79 of file dao_assert.h.

◆ DAO_ASSERT_ZERO

#define DAO_ASSERT_ZERO (   val,
  msg,
  ... 
)    DAO_ASSERT((val) == 0, msg, ##__VA_ARGS__)

Asserts that val == 0

Definition at line 84 of file dao_assert.h.

◆ DAO_ASSERT_ZERO_FATAL

#define DAO_ASSERT_ZERO_FATAL (   val,
  msg,
  ... 
)    DAO_ASSERT_FATAL((val) == 0, msg, ##__VA_ARGS__)

Asserts that val == 0 Reports failure and causes test to abort.

Definition at line 90 of file dao_assert.h.

◆ DAO_ASSERT_NOT_ZERO

#define DAO_ASSERT_NOT_ZERO (   val,
  msg,
  ... 
)    DAO_ASSERT((val) != 0, msg, ##__VA_ARGS__)

Asserts that val != 0

Definition at line 95 of file dao_assert.h.

◆ DAO_ASSERT_NOT_ZERO_FATAL

#define DAO_ASSERT_NOT_ZERO_FATAL (   val,
  msg,
  ... 
)    DAO_ASSERT_FATAL((val) != 0, msg, ##__VA_ARGS__)

Asserts that val != 0 Reports failure and causes test to abort.

Definition at line 101 of file dao_assert.h.

◆ DAO_ASSERT_NULL

#define DAO_ASSERT_NULL (   val,
  msg,
  ... 
)    DAO_ASSERT((val) == NULL, msg, ##__VA_ARGS__)

Asserts that val == NULL

Definition at line 106 of file dao_assert.h.

◆ DAO_ASSERT_NULL_FATAL

#define DAO_ASSERT_NULL_FATAL (   val,
  msg,
  ... 
)    DAO_ASSERT_FATAL((val) == NULL, msg, ##__VA_ARGS__)

Asserts that val == NULL Reports failure and causes test to abort.

Definition at line 112 of file dao_assert.h.

◆ DAO_ASSERT_NOT_NULL

#define DAO_ASSERT_NOT_NULL (   val,
  msg,
  ... 
)    DAO_ASSERT((val) != NULL, msg, ##__VA_ARGS__)

Asserts that val != NULL

Definition at line 117 of file dao_assert.h.

◆ DAO_ASSERT_NOT_NULL_FATAL

#define DAO_ASSERT_NOT_NULL_FATAL (   val,
  msg,
  ... 
)    DAO_ASSERT_FATAL((val) != NULL, msg, ##__VA_ARGS__)

Asserts that val != NULL Reports failure and causes test to abort.

Definition at line 123 of file dao_assert.h.