Zephyr API Documentation 4.0.0-rc3
A Scalable Open Source RTOS
Loading...
Searching...
No Matches
ztest_assert.h File Reference

Zephyr testing framework assertion macros. More...

#include <stdarg.h>
#include <stdbool.h>
#include <stdio.h>
#include <string.h>
#include <zephyr/tc_util.h>
#include <zephyr/ztest.h>

Go to the source code of this file.

Macros

#define zassert(cond, default_msg, ...)
 
#define zassume(cond, default_msg, ...)
 
#define zexpect(cond, default_msg, ...)
 
#define zassert_unreachable(...)
 Assert that this function call won't be reached.
 
#define zassert_true(cond, ...)
 Assert that cond is true.
 
#define zassert_false(cond, ...)
 Assert that cond is false.
 
#define zassert_ok(cond, ...)
 Assert that cond is 0 (success)
 
#define zassert_not_ok(cond, ...)
 Assert that cond is not 0 (failure)
 
#define zassert_is_null(ptr, ...)
 Assert that ptr is NULL.
 
#define zassert_not_null(ptr, ...)
 Assert that ptr is not NULL.
 
#define zassert_equal(a, b, ...)
 Assert that a equals b.
 
#define zassert_not_equal(a, b, ...)
 Assert that a does not equal b.
 
#define zassert_equal_ptr(a, b, ...)
 Assert that a equals b.
 
#define zassert_within(a, b, d, ...)
 Assert that a is within b with delta d.
 
#define zassert_between_inclusive(a, l, u, ...)
 Assert that a is greater than or equal to l and less than or equal to u.
 
#define zassert_mem_equal(...)
 Assert that 2 memory buffers have the same contents.
 
#define zassert_mem_equal__(buf, exp, size, ...)
 Internal assert that 2 memory buffers have the same contents.
 
#define zassert_str_equal(s1, s2, ...)
 Assert that 2 strings have the same contents.
 
#define zassume_true(cond, ...)
 Assume that cond is true.
 
#define zassume_false(cond, ...)
 Assume that cond is false.
 
#define zassume_ok(cond, ...)
 Assume that cond is 0 (success)
 
#define zassume_not_ok(cond, ...)
 Assume that cond is not 0 (failure)
 
#define zassume_is_null(ptr, ...)
 Assume that ptr is NULL.
 
#define zassume_not_null(ptr, ...)
 Assume that ptr is not NULL.
 
#define zassume_equal(a, b, ...)
 Assume that a equals b.
 
#define zassume_not_equal(a, b, ...)
 Assume that a does not equal b.
 
#define zassume_equal_ptr(a, b, ...)
 Assume that a equals b.
 
#define zassume_within(a, b, d, ...)
 Assume that a is within b with delta d.
 
#define zassume_between_inclusive(a, l, u, ...)
 Assume that a is greater than or equal to l and less than or equal to u.
 
#define zassume_mem_equal(...)
 Assume that 2 memory buffers have the same contents.
 
#define zassume_mem_equal__(buf, exp, size, ...)
 Internal assume that 2 memory buffers have the same contents.
 
#define zassume_str_equal(s1, s2, ...)
 Assumes that 2 strings have the same contents.
 
#define zexpect_true(cond, ...)
 Expect that cond is true, otherwise mark test as failed but continue its execution.
 
#define zexpect_false(cond, ...)
 Expect that cond is false, otherwise mark test as failed but continue its execution.
 
#define zexpect_ok(cond, ...)
 Expect that cond is 0 (success), otherwise mark test as failed but continue its execution.
 
#define zexpect_not_ok(cond, ...)
 Expect that cond is not 0 (failure), otherwise mark test as failed but continue its execution.
 
#define zexpect_is_null(ptr, ...)
 Expect that ptr is NULL, otherwise mark test as failed but continue its execution.
 
#define zexpect_not_null(ptr, ...)
 Expect that ptr is not NULL, otherwise mark test as failed but continue its execution.
 
#define zexpect_equal(a, b, ...)
 Expect that a equals b, otherwise mark test as failed but continue its execution.
 
#define zexpect_not_equal(a, b, ...)
 Expect that a does not equal b, otherwise mark test as failed but continue its execution.
 
#define zexpect_equal_ptr(a, b, ...)
 Expect that a equals b, otherwise mark test as failed but continue its execution.
 
#define zexpect_within(a, b, delta, ...)
 Expect that a is within b with delta d, otherwise mark test as failed but continue its execution.
 
#define zexpect_between_inclusive(a, lower, upper, ...)
 Expect that a is greater than or equal to l and less than or equal to u, otherwise mark test as failed but continue its execution.
 
#define zexpect_mem_equal(buf, exp, size, ...)
 Expect that 2 memory buffers have the same contents, otherwise mark test as failed but continue its execution.
 
#define zexpect_str_equal(s1, s2, ...)
 Expect that 2 strings have the same contents, otherwise mark test as failed but continue its execution.
 

Functions

const char * ztest_relative_filename (const char *file)
 
void ztest_test_fail (void)
 
void ztest_test_skip (void)
 
void ztest_test_expect_fail (void)
 
void ztest_skip_failed_assumption (void)
 

Detailed Description

Zephyr testing framework assertion macros.

Function Documentation

◆ ztest_relative_filename()

const char * ztest_relative_filename ( const char * file)

◆ ztest_skip_failed_assumption()

void ztest_skip_failed_assumption ( void )

◆ ztest_test_expect_fail()

void ztest_test_expect_fail ( void )

◆ ztest_test_fail()

void ztest_test_fail ( void )

◆ ztest_test_skip()

void ztest_test_skip ( void )