emlabcpp
modern opinionated embedded C++ library
emlabcpp::testing Namespace Reference

MIT License. More...

Classes

struct  test_result
 
struct  collect_request
 
struct  collect_reply
 
class  collect_awaiter
 
class  collector
 
class  collect_server
 
class  controller
 
class  controller_interface
 
class  controller_interface_adapter
 
struct  value_type_converter
 
struct  value_type_converter_getter
 
struct  value_type_converter_enum
 
struct  value_type_converter< bool >
 
struct  value_type_converter< int64_t >
 
struct  value_type_converter< std::bitset< N > >
 
struct  value_type_converter< std::string_view >
 
struct  value_type_converter< char const * >
 
struct  value_type_converter< std::byte >
 
struct  value_type_converter< std::chrono::duration< Rep, Ratio > >
 
struct  wait_interface
 
class  coroutine
 
struct  status_awaiter
 
struct  reactor_protocol_error
 
struct  controller_protocol_error
 
struct  internal_reactor_error
 
struct  controller_internal_error
 
class  executor
 
class  test_interface
 
class  test_callable
 
struct  empty_node_impl
 
struct  param_value_request
 
struct  param_value_reply
 
struct  param_value_key_request
 
struct  param_value_key_reply
 
struct  param_child_request
 
struct  param_child_reply
 
struct  param_child_count_request
 
struct  param_child_count_reply
 
struct  param_key_request
 
struct  param_key_reply
 
struct  param_type_request
 
struct  param_type_reply
 
struct  param_error
 
struct  params_awaiter
 
struct  param_value_processor
 
struct  param_variant_processor
 
struct  param_value_key_processor
 
struct  param_type_processor
 
struct  param_child_processor
 
struct  param_child_count_processor
 
struct  param_key_processor
 
class  parameters
 
class  parameters_server
 
struct  get_property
 
struct  get_count_reply
 
struct  get_suite_name_reply
 
struct  get_suite_date_reply
 
struct  get_test_name_request
 
struct  get_test_name_reply
 
struct  tree_error_reply
 
struct  test_finished
 
struct  boot
 
struct  exec_request
 
struct  error
 
struct  no_response_error
 
struct  wrong_type_error
 
struct  input_message_protocol_error
 
struct  reactor_internal_error_report
 
struct  packet_def
 
class  reactor
 
class  reactor_interface_adapter
 

Typedefs

using name_buffer = string_buffer< 32 >
 
using key_type_buffer = string_buffer< 32 >
 
using node_id = uint32_t
 
using child_count = uint32_t
 
using child_id = uint32_t
 
using node_type_enum = contiguous_tree_type
 
using string_buffer = string_buffer< 128 >
 
using key_type = key_type_buffer
 
using value_type = std::variant< int64_t, float, bool, string_buffer >
 
using run_id = uint32_t
 
using test_id = uint16_t
 
using data_tree = contiguous_tree< key_type, value_type >
 
using data_array_handle = typename data_tree::array_handle
 
using data_object_handle = typename data_tree::object_handle
 
using data_const_array_handle = typename data_tree::const_array_handle
 
using data_const_object_handle = typename data_tree::const_object_handle
 
using collect_key_type = key_type_buffer
 
using collect_value_type = std::variant< value_type, contiguous_container_type >
 
using collect_server_client_group = std::variant< collect_reply, tree_error_reply >
 
using collect_server_client_message = typename protocol::handler< collect_server_client_group >::message_type
 
using collect_client_server_message = typename protocol::handler< collect_request >::message_type
 
using collect_reply_callback = static_function< void(collect_server_client_group const &), 32 >
 
using collect_client_transmit_callback = static_function< result(protocol::channel_type, collect_client_server_message const &), 32 >
 
using collect_server_transmit_callback = static_function< result(protocol::channel_type, collect_server_client_message const &), 32 >
 
using error_variant = std::variant< reactor_protocol_error, controller_protocol_error, internal_reactor_error, controller_internal_error >
 
using test_ll_node = linked_list_node_base< test_interface >
 
template<typename T >
using test_unit = linked_list_node< T, test_interface >
 
using empty_node = test_unit< empty_node_impl >
 
template<valid_test_callable Callable>
using test_linked_callable = test_unit< test_callable< Callable > >
 
using params_client_server_group = protocol::tag_group< param_value_request, param_child_request, param_child_count_request, param_key_request, param_type_request, param_value_key_request, param_error >
 
using params_client_server_variant = typename protocol::traits_for< params_client_server_group >::value_type
 
using params_client_server_message = typename protocol::handler< params_client_server_group >::message_type
 
using params_server_client_group = protocol::tag_group< param_value_reply, param_child_reply, param_child_count_reply, param_key_reply, param_type_reply, param_value_key_reply, tree_error_reply >
 
using params_server_client_variant = typename protocol::traits_for< params_server_client_group >::value_type
 
using params_server_client_message = typename protocol::handler< params_server_client_group >::message_type
 
using params_reply_callback = static_function< void(params_server_client_variant const &), 32 >
 
using params_client_transmit_callback = static_function< result(protocol::channel_type, params_client_server_message const &), 32 >
 
using params_server_transmit_callback = static_function< result(protocol::channel_type, params_server_client_message const &), 32 >
 
template<typename T >
using param_value_awaiter = params_awaiter< param_value_processor< T > >
 
using param_variant_awaiter = params_awaiter< param_variant_processor >
 
template<typename T >
using param_value_key_awaiter = params_awaiter< param_value_key_processor< T > >
 
using param_type_awaiter = params_awaiter< param_type_processor >
 
using param_child_awaiter = params_awaiter< param_child_processor >
 
using param_child_count_awaiter = params_awaiter< param_child_count_processor >
 
using param_key_awaiter = params_awaiter< param_key_processor >
 
using controller_reactor_group = protocol::tag_group< get_property< msgid::SUITE_NAME >, get_property< msgid::SUITE_DATE >, get_property< msgid::COUNT >, get_test_name_request, exec_request >
 
using controller_reactor_variant = typename protocol::traits_for< controller_reactor_group >::value_type
 
using controller_reactor_message = typename protocol::handler< controller_reactor_group >::message_type
 
using reactor_error_variant = std::variant< error< TEST_IS_RUNING_E >, error< TEST_NOT_FOUND_E >, error< BAD_TEST_ID_E >, error< UNDESIRED_MSG_E >, no_response_error, wrong_type_error, tree_error_reply, error< WRONG_MESSAGE_E >, input_message_protocol_error >
 
using reactor_controller_group = protocol::tag_group< boot, get_count_reply, get_test_name_reply, test_finished, get_suite_name_reply, get_suite_date_reply, reactor_internal_error_report >
 
using reactor_controller_variant = typename protocol::traits_for< reactor_controller_group >::value_type
 
using reactor_controller_message = typename protocol::handler< reactor_controller_group >::message_type
 
using reactor_transmit_callback = static_function< result(protocol::channel_type, reactor_controller_message const &), 32 >
 
using controller_transmit_callback = static_function< result(protocol::channel_type, controller_reactor_message const &), 32 >
 
using packet_payload = protocol::multiplexer_payload< 256 >
 
using packet = protocol::packet< packet_def, packet_payload >
 
using endpoint = protocol::multiplexed_endpoint< packet >
 
using message = typename packet::message_type
 

Enumerations

enum class  test_status : uint8_t {
  SUCCESS = 0x1 ,
  SKIPPED = 0x2 ,
  FAILED = 0x3 ,
  ERRORED = 0x4
}
 
enum class  coro_state : uint8_t {
  WAITING = 0x1 ,
  ERRORED = 0x3 ,
  SKIPPED = 0x4 ,
  FAILED = 0x5 ,
  DONE = 0x6
}
 
enum  params_enum : uint8_t {
  PARAM_VALUE = 0x10 ,
  PARAM_CHILD = 0x11 ,
  PARAM_CHILD_COUNT = 0x12 ,
  PARAM_KEY = 0x13 ,
  PARAM_TYPE = 0x14 ,
  PARAM_VALUE_KEY = 0x15 ,
  PARAM_ERROR = 0x16
}
 
enum class  msgid : uint8_t {
  EXEC = 0x1 ,
  COUNT = 0x2 ,
  NAME = 0x3 ,
  SUITE_NAME = 0x6 ,
  SUITE_DATE = 0x7 ,
  FINISHED = 0x9 ,
  ERROR = 0xa ,
  FAILURE = 0xb ,
  BOOT = 0xc ,
  INTERNAL_ERROR = 0xf0 ,
  PROTOCOL_ERROR = 0xf1 ,
  TREE_ERROR = 0xf2
}
 
enum  error_enum : uint8_t {
  TEST_IS_RUNING_E = 0x1 ,
  TEST_NOT_FOUND_E = 0x2 ,
  BAD_TEST_ID_E = 0x5 ,
  UNDESIRED_MSG_E = 0x6 ,
  NO_RESPONSE_E = 0x7 ,
  TREE_E = 0x8 ,
  WRONG_TYPE_E = 0x9 ,
  WRONG_MESSAGE_E = 0xa ,
  INPUT_MESSAGE_PROTOCOL_ERROR = 0xb
}
 

Functions

constexpr bool is_problematic (test_status stat)
 
status_awaiter expect (collector &c, bool expr, std::source_location loc=std::source_location::current())
 
template<typename T >
requires(N<=string_buffer::capacity) struct value_type_converter< emlabcpp requires(alternative_of< T, value_type >) struct value_type_converter< T > requires (!std::same_as< T, int64_t > &&std::is_integral_v< T > &&!std::same_as< T, bool >) struct value_type_converter< T >
 
status_awaiter expect (bool expr)
 
status_awaiter fail ()
 
status_awaiter skip ()
 
template<valid_test_callable Callable>
 test_callable (std::string_view const name, Callable cb) -> test_callable< Callable >
 
template<typename Unit , typename Reactor , typename... Args>
result construct_test_unit (pmr::memory_resource &mem_res, Reactor &reactor, Args &&... args)
 
template<typename Callable , typename Reactor >
result construct_test_callable (pmr::memory_resource &mem_res, Reactor &reactor, std::string_view name, Callable callable)
 
template<typename Callable , typename Reactor >
void construct_test_callable (pmr::memory_resource &mem_res, Reactor &reactor, std::string_view name, Callable callable, result &res)
 

Variables

static constexpr protocol::channel_type collect_channel = 2
 
template<typename T >
concept value_type_convertible
 
template<typename T >
concept valid_test_callable
 
static constexpr protocol::channel_type params_channel = 3
 
static constexpr protocol::channel_type core_channel = 1
 

Detailed Description

MIT License.

Copyright (c) 2025 Jan Veverak Koniarik

Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:

The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.

THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.


Class Documentation

◆ emlabcpp::testing::collect_request

struct emlabcpp::testing::collect_request
Class Members
bool expects_reply
optional< collect_key_type > opt_key
node_id parent
collect_value_type value

◆ emlabcpp::testing::collect_reply

struct emlabcpp::testing::collect_reply
Class Members
node_id nid

◆ emlabcpp::testing::value_type_converter

struct emlabcpp::testing::value_type_converter

template<typename T>
struct emlabcpp::testing::value_type_converter< T >

◆ emlabcpp::testing::reactor_protocol_error

struct emlabcpp::testing::reactor_protocol_error
+ Collaboration diagram for emlabcpp::testing::reactor_protocol_error:
Class Members
error_record rec

◆ emlabcpp::testing::controller_protocol_error

struct emlabcpp::testing::controller_protocol_error
+ Collaboration diagram for emlabcpp::testing::controller_protocol_error:
Class Members
error_record rec

◆ emlabcpp::testing::internal_reactor_error

struct emlabcpp::testing::internal_reactor_error
Class Members
reactor_error_variant val

◆ emlabcpp::testing::controller_internal_error

struct emlabcpp::testing::controller_internal_error
Class Members
msgid msg_id

Typedef Documentation

◆ child_count

using emlabcpp::testing::child_count = typedef uint32_t

◆ child_id

using emlabcpp::testing::child_id = typedef uint32_t

◆ collect_client_server_message

◆ collect_client_transmit_callback

◆ collect_key_type

◆ collect_reply_callback

◆ collect_server_client_group

◆ collect_server_client_message

◆ collect_server_transmit_callback

◆ collect_value_type

◆ controller_reactor_group

◆ controller_reactor_message

◆ controller_reactor_variant

◆ controller_transmit_callback

◆ data_array_handle

◆ data_const_array_handle

◆ data_const_object_handle

◆ data_object_handle

◆ data_tree

◆ empty_node

◆ endpoint

◆ error_variant

◆ key_type

◆ key_type_buffer

◆ message

◆ name_buffer

◆ node_id

using emlabcpp::testing::node_id = typedef uint32_t

◆ node_type_enum

◆ packet

◆ packet_payload

◆ param_child_awaiter

◆ param_child_count_awaiter

◆ param_key_awaiter

◆ param_type_awaiter

◆ param_value_awaiter

template<typename T >
using emlabcpp::testing::param_value_awaiter = typedef params_awaiter< param_value_processor< T > >

◆ param_value_key_awaiter

◆ param_variant_awaiter

◆ params_client_server_group

◆ params_client_server_message

◆ params_client_server_variant

◆ params_client_transmit_callback

◆ params_reply_callback

◆ params_server_client_group

◆ params_server_client_message

◆ params_server_client_variant

◆ params_server_transmit_callback

◆ reactor_controller_group

◆ reactor_controller_message

◆ reactor_controller_variant

◆ reactor_error_variant

◆ reactor_transmit_callback

◆ run_id

using emlabcpp::testing::run_id = typedef uint32_t

◆ string_buffer

◆ test_id

using emlabcpp::testing::test_id = typedef uint16_t

◆ test_linked_callable

template<valid_test_callable Callable>
using emlabcpp::testing::test_linked_callable = typedef test_unit< test_callable< Callable > >

◆ test_ll_node

◆ test_unit

template<typename T >
using emlabcpp::testing::test_unit = typedef linked_list_node< T, test_interface >

◆ value_type

using emlabcpp::testing::value_type = typedef std::variant< int64_t, float, bool, string_buffer >

Enumeration Type Documentation

◆ coro_state

enum emlabcpp::testing::coro_state : uint8_t
strong
Enumerator
WAITING 
ERRORED 
SKIPPED 
FAILED 
DONE 

◆ error_enum

Enumerator
TEST_IS_RUNING_E 
TEST_NOT_FOUND_E 
BAD_TEST_ID_E 
UNDESIRED_MSG_E 
NO_RESPONSE_E 
TREE_E 
WRONG_TYPE_E 
WRONG_MESSAGE_E 
INPUT_MESSAGE_PROTOCOL_ERROR 

◆ msgid

enum emlabcpp::testing::msgid : uint8_t
strong
Enumerator
EXEC 
COUNT 
NAME 
SUITE_NAME 
SUITE_DATE 
FINISHED 
ERROR 
FAILURE 
BOOT 
INTERNAL_ERROR 
PROTOCOL_ERROR 
TREE_ERROR 

◆ params_enum

Enumerator
PARAM_VALUE 
PARAM_CHILD 
PARAM_CHILD_COUNT 
PARAM_KEY 
PARAM_TYPE 
PARAM_VALUE_KEY 
PARAM_ERROR 

◆ test_status

enum emlabcpp::testing::test_status : uint8_t
strong
Enumerator
SUCCESS 
SKIPPED 
FAILED 
ERRORED 

Function Documentation

◆ construct_test_callable() [1/2]

template<typename Callable , typename Reactor >
result emlabcpp::testing::construct_test_callable ( pmr::memory_resource mem_res,
Reactor &  reactor,
std::string_view  name,
Callable  callable 
)

◆ construct_test_callable() [2/2]

template<typename Callable , typename Reactor >
void emlabcpp::testing::construct_test_callable ( pmr::memory_resource mem_res,
Reactor &  reactor,
std::string_view  name,
Callable  callable,
result res 
)

References emlabcpp::res.

◆ construct_test_unit()

template<typename Unit , typename Reactor , typename... Args>
result emlabcpp::testing::construct_test_unit ( pmr::memory_resource mem_res,
Reactor &  reactor,
Args &&...  args 
)

◆ expect() [1/2]

status_awaiter emlabcpp::testing::expect ( bool  expr)
inline

References DONE, and FAILED.

◆ expect() [2/2]

status_awaiter emlabcpp::testing::expect ( collector c,
bool  expr,
std::source_location  loc = std::source_location::current() 
)
inline

◆ fail()

status_awaiter emlabcpp::testing::fail ( )
inline

References FAILED.

◆ is_problematic()

constexpr bool emlabcpp::testing::is_problematic ( test_status  stat)
constexpr

References ERRORED, and FAILED.

◆ requires()

template<typename T >
requires ( N <= string_buffer::capacity ) struct value_type_converter< emlabcpp requires ( alternative_of< T, value_type > ) struct value_type_converter< T > emlabcpp::testing::requires ( !std::same_as< T, int64_t > &&std::is_integral_v< T > &&!std::same_as< T, bool >  )

◆ skip()

status_awaiter emlabcpp::testing::skip ( )
inline

References SKIPPED.

◆ test_callable()

template<valid_test_callable Callable>
emlabcpp::testing::test_callable ( std::string_view const  name,
Callable  cb 
) -> test_callable< Callable >

Variable Documentation

◆ collect_channel

constexpr protocol::channel_type emlabcpp::testing::collect_channel = 2
staticconstexpr

◆ core_channel

constexpr protocol::channel_type emlabcpp::testing::core_channel = 1
staticconstexpr

◆ params_channel

constexpr protocol::channel_type emlabcpp::testing::params_channel = 3
staticconstexpr

◆ valid_test_callable

template<typename T >
concept emlabcpp::testing::valid_test_callable
Initial value:
= requires( T t, pmr::memory_resource& mem_resource ) {
{ t( mem_resource ) } -> std::same_as< coroutine< void > >;
}
requires(!range_container< Container >) std
Definition: impl.h:81

◆ value_type_convertible

template<typename T >
concept emlabcpp::testing::value_type_convertible
Initial value:
= requires( T const& item, value_type const& val ) {
{ value_type_converter< T >::to_value( item ) } -> std::convertible_to< value_type >;
{
value_type_converter< T >::from_value( val )
} -> std::convertible_to< std::optional< T > >;
}
requires(N<=string_buffer::capacity) struct value_type_converter< emlabcpp requires(alternative_of< T, value_type >) struct value_type_converter< T > requires(!std::same_as< T, int64_t > &&std::is_integral_v< T > &&!std::same_as< T, bool >) struct value_type_converter< T >
Definition: convert.h:113
std::variant< int64_t, float, bool, string_buffer > value_type
Definition: base.h:51