Zephyr API Documentation 4.0.0-rc2
A Scalable Open Source RTOS
|
Macros | |
#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. | |
This module provides assumptions when using Ztest.
#define zassume_between_inclusive | ( | a, | |
l, | |||
u, | |||
... ) |
#include </home/runner/work/zephyr/zephyr/subsys/testsuite/ztest/include/zephyr/ztest_assert.h>
Assume that a is greater than or equal to l and less than or equal to u.
If the assumption fails, the test will be marked as "skipped".
a | Value to compare |
l | Lower limit |
u | Upper limit |
... | Optional message and variables to print if the assumption fails |
#define zassume_equal | ( | a, | |
b, | |||
... ) |
#include </home/runner/work/zephyr/zephyr/subsys/testsuite/ztest/include/zephyr/ztest_assert.h>
Assume that a equals b.
a and b won't be converted and will be compared directly. If the assumption fails, the test will be marked as "skipped".
a | Value to compare |
b | Value to compare |
... | Optional message and variables to print if the assumption fails |
#define zassume_equal_ptr | ( | a, | |
b, | |||
... ) |
#include </home/runner/work/zephyr/zephyr/subsys/testsuite/ztest/include/zephyr/ztest_assert.h>
Assume that a equals b.
a and b will be converted to void *
before comparing. If the assumption fails, the test will be marked as "skipped".
a | Value to compare |
b | Value to compare |
... | Optional message and variables to print if the assumption fails |
#define zassume_false | ( | cond, | |
... ) |
#include </home/runner/work/zephyr/zephyr/subsys/testsuite/ztest/include/zephyr/ztest_assert.h>
Assume that cond is false.
If the assumption fails, the test will be marked as "skipped".
cond | Condition to check |
... | Optional message and variables to print if the assumption fails |
#define zassume_is_null | ( | ptr, | |
... ) |
#include </home/runner/work/zephyr/zephyr/subsys/testsuite/ztest/include/zephyr/ztest_assert.h>
Assume that ptr is NULL.
If the assumption fails, the test will be marked as "skipped".
ptr | Pointer to compare |
... | Optional message and variables to print if the assumption fails |
#define zassume_mem_equal | ( | ... | ) |
#include </home/runner/work/zephyr/zephyr/subsys/testsuite/ztest/include/zephyr/ztest_assert.h>
Assume that 2 memory buffers have the same contents.
This macro calls the final memory comparison assumption macro. Using double expansion allows providing some arguments by macros that would expand to more than one values (ANSI-C99 defines that all the macro arguments have to be expanded before macro call).
... | Arguments, see zassume_mem_equal__ for real arguments accepted. |
#define zassume_mem_equal__ | ( | buf, | |
exp, | |||
size, | |||
... ) |
#include </home/runner/work/zephyr/zephyr/subsys/testsuite/ztest/include/zephyr/ztest_assert.h>
Internal assume that 2 memory buffers have the same contents.
If the assumption fails, the test will be marked as "skipped".
buf | Buffer to compare |
exp | Buffer with expected contents |
size | Size of buffers |
... | Optional message and variables to print if the assumption fails |
#define zassume_not_equal | ( | a, | |
b, | |||
... ) |
#include </home/runner/work/zephyr/zephyr/subsys/testsuite/ztest/include/zephyr/ztest_assert.h>
Assume that a does not equal b.
a and b won't be converted and will be compared directly. If the assumption fails, the test will be marked as "skipped".
a | Value to compare |
b | Value to compare |
... | Optional message and variables to print if the assumption fails |
#define zassume_not_null | ( | ptr, | |
... ) |
#include </home/runner/work/zephyr/zephyr/subsys/testsuite/ztest/include/zephyr/ztest_assert.h>
Assume that ptr is not NULL.
If the assumption fails, the test will be marked as "skipped".
ptr | Pointer to compare |
... | Optional message and variables to print if the assumption fails |
#define zassume_not_ok | ( | cond, | |
... ) |
#include </home/runner/work/zephyr/zephyr/subsys/testsuite/ztest/include/zephyr/ztest_assert.h>
Assume that cond is not 0 (failure)
If the assumption fails, the test will be marked as "skipped".
cond | Condition to check |
... | Optional message and variables to print if the assumption fails |
#define zassume_ok | ( | cond, | |
... ) |
#include </home/runner/work/zephyr/zephyr/subsys/testsuite/ztest/include/zephyr/ztest_assert.h>
Assume that cond is 0 (success)
If the assumption fails, the test will be marked as "skipped".
cond | Condition to check |
... | Optional message and variables to print if the assumption fails |
#define zassume_str_equal | ( | s1, | |
s2, | |||
... ) |
#include </home/runner/work/zephyr/zephyr/subsys/testsuite/ztest/include/zephyr/ztest_assert.h>
Assumes that 2 strings have the same contents.
s1 | The first string |
s2 | The second string |
... | Optional message and variables to print if the expectation fails |
#define zassume_true | ( | cond, | |
... ) |
#include </home/runner/work/zephyr/zephyr/subsys/testsuite/ztest/include/zephyr/ztest_assert.h>
Assume that cond is true.
If the assumption fails, the test will be marked as "skipped".
cond | Condition to check |
... | Optional message and variables to print if the assumption fails |
#define zassume_within | ( | a, | |
b, | |||
d, | |||
... ) |
#include </home/runner/work/zephyr/zephyr/subsys/testsuite/ztest/include/zephyr/ztest_assert.h>
Assume that a is within b with delta d.
If the assumption fails, the test will be marked as "skipped".
a | Value to compare |
b | Value to compare |
d | Delta |
... | Optional message and variables to print if the assumption fails |