#include <zephyr/ztest.h>
#include <zephyr/sys/__assert.h>
#include <zephyr/kernel.h>
#include <string.h>
#include <zpp.hpp>
Go to the source code of this file.
|
| ZTEST_SUITE (test_zpp_result, NULL, NULL, NULL, NULL, NULL) |
|
| ZTEST (test_zpp_result, test_result) |
|
◆ ZTEST()
ZTEST |
( |
test_zpp_result |
, |
|
|
test_result |
|
|
) |
| |
Definition at line 39 of file main.cpp.
45 zassert_true(!res_a,
"res_a should be false\n");
46 zassert_false(res_b,
"res_b should be false\n");
47 zassert_true(res_c ==
false,
"res_c should be false\n");
51 zassert_true(res_a ==
false,
"res_a should be false\n");
55 zassert_true(res_a ==
true,
"res_a should be true\n");
56 zassert_true(res_a.
value() == 12345,
"res_a.value() should be 12345\n");
59 zassert_true(res_d ==
true,
"res_d should be true\n");
60 zassert_true(res_d.value() == 12345,
"res_d.value() should be 12345\n");
63 zassert_false(res_d,
"res_d should be false\n");
67 zassert_false(res_e,
"res_d should be true\n");
70 zassert_true(!!res_e,
"res_d should be true\n");
73 zassert_true(res_e.
error() == 0,
"res_d should hold 0");
76 zassert_false(res_f,
"res_f should be false\n");
79 zassert_false(res_g,
"res_g should be false\n");
82 zassert_false(res_h,
"res_h should be false\n");
helper class for error result
void assign_value(const T_Ok &v) noexcept
T_Ok & value() noexcept
return a reference to the OK value
T_Error & error() noexcept
return a reference to the OK value
@ k_inval
Invalid argument.
@ k_already
Operation already in progress.
References zpp::result< T_Ok, T_Error >::assign_value(), zpp::result< T_Ok, T_Error >::error(), zpp::k_already, zpp::k_inval, and zpp::result< T_Ok, T_Error >::value().
◆ ZTEST_SUITE()
ZTEST_SUITE |
( |
test_zpp_result |
, |
|
|
NULL |
, |
|
|
NULL |
, |
|
|
NULL |
, |
|
|
NULL |
, |
|
|
NULL |
|
|
) |
| |