Zephyr API Documentation 4.0.0
A Scalable Open Source RTOS
|
Macros | |
#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. | |
This module provides expectations when using Ztest.
#define zexpect_between_inclusive | ( | a, | |
lower, | |||
upper, | |||
... ) |
#include </home/runner/work/zephyr/zephyr/subsys/testsuite/ztest/include/zephyr/ztest_assert.h>
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.
a | Value to compare |
lower | Lower limit |
upper | Upper limit |
... | Optional message and variables to print if the expectation fails |
#define zexpect_equal | ( | a, | |
b, | |||
... ) |
#include </home/runner/work/zephyr/zephyr/subsys/testsuite/ztest/include/zephyr/ztest_assert.h>
Expect that a equals b, otherwise mark test as failed but continue its execution.
a | Value to compare |
b | Value to compare |
... | Optional message and variables to print if the expectation fails |
#define zexpect_equal_ptr | ( | a, | |
b, | |||
... ) |
#include </home/runner/work/zephyr/zephyr/subsys/testsuite/ztest/include/zephyr/ztest_assert.h>
Expect that a equals b, otherwise mark test as failed but continue its execution.
a and b will be converted to void *
before comparing.
a | Value to compare |
b | Value to compare |
... | Optional message and variables to print if the expectation fails |
#define zexpect_false | ( | cond, | |
... ) |
#include </home/runner/work/zephyr/zephyr/subsys/testsuite/ztest/include/zephyr/ztest_assert.h>
Expect that cond is false, otherwise mark test as failed but continue its execution.
cond | Condition to check |
... | Optional message and variables to print if the expectation fails |
#define zexpect_is_null | ( | ptr, | |
... ) |
#include </home/runner/work/zephyr/zephyr/subsys/testsuite/ztest/include/zephyr/ztest_assert.h>
Expect that ptr is NULL, otherwise mark test as failed but continue its execution.
ptr | Pointer to compare |
... | Optional message and variables to print if the expectation fails |
#define zexpect_mem_equal | ( | buf, | |
exp, | |||
size, | |||
... ) |
#include </home/runner/work/zephyr/zephyr/subsys/testsuite/ztest/include/zephyr/ztest_assert.h>
Expect that 2 memory buffers have the same contents, otherwise mark test as failed but continue its execution.
buf | Buffer to compare |
exp | Buffer with expected contents |
size | Size of buffers |
... | Optional message and variables to print if the expectation fails |
#define zexpect_not_equal | ( | a, | |
b, | |||
... ) |
#include </home/runner/work/zephyr/zephyr/subsys/testsuite/ztest/include/zephyr/ztest_assert.h>
Expect that a does not equal b, otherwise mark test as failed but continue its execution.
a and b won't be converted and will be compared directly.
a | Value to compare |
b | Value to compare |
... | Optional message and variables to print if the expectation fails |
#define zexpect_not_null | ( | ptr, | |
... ) |
#include </home/runner/work/zephyr/zephyr/subsys/testsuite/ztest/include/zephyr/ztest_assert.h>
Expect that ptr is not NULL, otherwise mark test as failed but continue its execution.
ptr | Pointer to compare |
... | Optional message and variables to print if the expectation fails |
#define zexpect_not_ok | ( | cond, | |
... ) |
#include </home/runner/work/zephyr/zephyr/subsys/testsuite/ztest/include/zephyr/ztest_assert.h>
Expect that cond is not 0 (failure), otherwise mark test as failed but continue its execution.
cond | Condition to check |
... | Optional message and variables to print if the expectation fails |
#define zexpect_ok | ( | cond, | |
... ) |
#include </home/runner/work/zephyr/zephyr/subsys/testsuite/ztest/include/zephyr/ztest_assert.h>
Expect that cond is 0 (success), otherwise mark test as failed but continue its execution.
cond | Condition to check |
... | Optional message and variables to print if the expectation fails |
#define zexpect_str_equal | ( | s1, | |
s2, | |||
... ) |
#include </home/runner/work/zephyr/zephyr/subsys/testsuite/ztest/include/zephyr/ztest_assert.h>
Expect that 2 strings have the same contents, otherwise mark test as failed but continue its execution.
s1 | The first string |
s2 | The second string |
... | Optional message and variables to print if the expectation fails |
#define zexpect_true | ( | cond, | |
... ) |
#include </home/runner/work/zephyr/zephyr/subsys/testsuite/ztest/include/zephyr/ztest_assert.h>
Expect that cond is true, otherwise mark test as failed but continue its execution.
cond | Condition to check |
... | Optional message and variables to print if the expectation fails |
#define zexpect_within | ( | a, | |
b, | |||
delta, | |||
... ) |
#include </home/runner/work/zephyr/zephyr/subsys/testsuite/ztest/include/zephyr/ztest_assert.h>
Expect that a is within b with delta d, otherwise mark test as failed but continue its execution.
a | Value to compare |
b | Value to compare |
delta | Difference between a and b |
... | Optional message and variables to print if the expectation fails |