#pragma once #include #include #include #include #include namespace evo::network_test { inline void check(bool ok, std::source_location at = std::source_location::current()) { if (!ok) throw std::runtime_error(std::string{"network "} + at.file_name() + ":" + std::to_string(at.line())); } // The value of an optional that the test requires to be present. template const T& must(const std::optional& o, std::source_location at = std::source_location::current()) { if (!o) throw std::runtime_error(std::string{"network missing value "} + at.file_name() + ":" + std::to_string(at.line())); return *o; } template bool refused(const std::expected& r, E e) { return !r && r.error() == e; } void protocol_tests(); void tls_tests(); void session_tests(); void control_tests(); } // namespace evo::network_test #define CHECK(...) ::evo::network_test::check(static_cast(__VA_ARGS__))