The two functions did not have unit tests, and at least one
issue with input validation have been indentified and fixed
prior to these.
Signed-off-by: Emil Gydesen <emil.gydesen@nordicsemi.no>
This patch file updates the use of assertion macros
comparing strings.
Command line used:
```
./scripts/coccicheck --mode=patch \
--cocci=scripts/coccinelle/ztest_strcmp.cocci tests/
```
Signed-off-by: Rubin Gerritsen <rubin.gerritsen@nordicsemi.no>
This macro allows to know the size of a struct member at compile time.
Several parts of the Zephyr code are currently using directly the macro
code.
Also added a unit test.
Signed-off-by: Adrien Ricciardi <aricciardi@baylibre.com>
Add functions to do XOR on arrays of memory, with one that
takes arbitrary sizes and one for 32 bits and 128 bits as
those are common sizes for this functionality.
Signed-off-by: Emil Gydesen <emil.gydesen@nordicsemi.no>
Add tests for the following two macros
* ARRAY_FOR_EACH(array, idx_var)
* ARRAY_FOR_EACH_PTR(array, ptr_var)
Signed-off-by: Christopher Friedt <cfriedt@meta.com>
As code is moved from test.inc to main.c a compliance check is
run for the first time on that code. Fixing warnings.
Signed-off-by: Krzysztof Chruściński <krzysztof.chruscinski@nordicsemi.no>
Rework test structure to handle C++ test in a better way. Similar
approach already applied in other tests which are executed for C
and C++. Getting rid of test.inc which due to non-standard extension
was not covered by complience check.
Signed-off-by: Krzysztof Chruściński <krzysztof.chruscinski@nordicsemi.no>
It's similar to DIV_ROUND_UP, but rounds to the nearest integer.
Some basic unit tests were introduced to check that it works as
intended.
Signed-off-by: Kornel Dulęba <mindal@semihalf.com>
Add a bunch of missing "zephyr/" prefixes to #include statements in
various test and test framework files.
Signed-off-by: Fabio Baltieri <fabiobaltieri@google.com>
In order to bring consistency in-tree, migrate all tests to the new
prefix <zephyr/...>. Note that the conversion has been scripted, refer
to #45388 for more details.
Signed-off-by: Gerard Marull-Paretas <gerard.marull@nordicsemi.no>
Move all the tests into an include file that is included once from the
main C-compiled module, and again from a linked in C++-compiled
module. The C compile invokes both test suites.
Signed-off-by: Peter Bigot <peter.bigot@nordicsemi.no>
Added separator (e.g. comma or semicolon) parameter to FOR_EACH_ family.
Separator is added between macro execution for each argument and not at
the end.
Signed-off-by: Krzysztof Chruscinski <krzysztof.chruscinski@nordicsemi.no>
IS_EMPTY macro allows to check if defined name is empty, i.e.
does not contain replacement list.
LIST_DROP_EMPTY macro may be used to process __VA_ARGS__ type lists,
e.g. a,b,,c , and remove empty elements.
Signed-off-by: Dominik Ermel <dominik.ermel@nordicsemi.no>
These are short-circuiting utility helpers that can save typing
in situations where avoiding evaluation of the not-taken branch
skips invalid expressions.
Signed-off-by: Martí Bolívar <marti.bolivar@nordicsemi.no>