26 #include "../../protocol/packet_handler.h"
27 #include "../../result.h"
28 #include "../linked_list.h"
47 [[nodiscard]]
virtual std::string_view
get_name()
const = 0;
58 template <
typename T >
60 { t( mem_resource ) } -> std::same_as< coroutine< void > >;
63 template <
typename T >
66 template < val
id_test_callable Callable >
72 , cb_( std::move( cb ) )
78 , cb_( std::move( cb ) )
80 rec.register_test(
this );
86 [[nodiscard]] std::string_view
get_name()
const override
88 return std::string_view{ name_.data(), name_.
size() };
93 return cb_( mem_resource );
101 template < val
id_test_callable Callable >
106 [[nodiscard]] std::string_view
get_name()
const override
119 template < val
id_test_callable Callable >
123 template <
typename Unit,
typename Reactor,
typename... Args >
127 void* p = mem_res.
allocate(
sizeof( unode ),
alignof( unode ) );
129 return result::ERROR;
131 std::construct_at(
reinterpret_cast< unode*
>( p ), std::forward< Args >(
args )... );
135 return result::SUCCESS;
138 template <
typename Callable,
typename Reactor >
142 std::string_view name,
145 return construct_test_unit< test_callable< Callable > >(
146 mem_res,
reactor, name, std::move( callable ) );
149 template <
typename Callable,
typename Reactor >
153 std::string_view name,
157 if (
res != result::SUCCESS )
159 res = construct_test_unit< test_callable< Callable > >(
160 mem_res,
reactor, name, std::move( callable ) );
Definition: linked_list.h:33
Definition: linked_list.h:138
Definition: memory_resource.h:33
virtual void * allocate(std::size_t bytes, std::size_t alignment)=0
void register_test(linked_list_node_base< test_interface > &test)
Definition: reactor.h:75
Definition: interface.h:68
test_callable(std::string_view const name, Callable cb)
Definition: interface.h:70
test_callable(std::string_view const name, auto &rec, Callable cb)
Definition: interface.h:76
coroutine< void > run(pmr::memory_resource &mem_resource) final
Definition: interface.h:91
std::string_view get_name() const override
Definition: interface.h:86
test_callable(test_callable &&) noexcept=default
Definition: interface.h:38
virtual std::string_view get_name() const =0
virtual ~test_interface()=default
test_interface & operator=(test_interface const &)=delete
test_interface(test_interface const &)=delete
virtual coroutine< void > run(pmr::memory_resource &)=0
virtual coroutine< void > setup(pmr::memory_resource &)
test_interface & operator=(test_interface &&)=default
virtual coroutine< void > teardown(pmr::memory_resource &)
test_interface(test_interface &&other)=default
MIT License.
Definition: base.h:37
result construct_test_unit(pmr::memory_resource &mem_res, Reactor &reactor, Args &&... args)
Definition: interface.h:124
test_callable(std::string_view const name, Callable cb) -> test_callable< Callable >
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
result construct_test_callable(pmr::memory_resource &mem_res, Reactor &reactor, std::string_view name, Callable callable)
Definition: interface.h:139
concept valid_test_callable
Definition: interface.h:59
Args const & args
Definition: min_max.h:83
T res
Definition: algorithm.h:505
result represents an result of some operation, as an alternative to returning just bool with true/fal...
Definition: result.h:42
constexpr std::size_t size() const
Definition: string_buffer.h:75
Definition: interface.h:105
std::string_view get_name() const override
Definition: interface.h:106
coroutine< void > run(pmr::memory_resource &) override
Definition: interface.h:111