/* Copyright (c) 2018-2025 Marcelo Zimbres Silva (mzimbres@gmail.com) * * Distributed under the Boost Software License, Version 1.0. (See * accompanying file LICENSE.txt) */ #ifndef BOOST_REDIS_TEST_SANSIO_UTILS_HPP #define BOOST_REDIS_TEST_SANSIO_UTILS_HPP #include #include #include #include #include #include #include #include namespace boost::redis::detail { class multiplexer; // Read data into the multiplexer with the following steps // // 1. prepare_read // 2. get_read_buffer // 3. Copy data in the buffer from 2. // 4. commit_read; // // This is used in the multiplexer tests. void read(multiplexer& mpx, std::string_view data); // Utilities for checking logs struct log_message { logger::level lvl; std::string msg; }; struct log_fixture { std::vector msgs; void check_log( std::initializer_list expected, source_location loc = BOOST_CURRENT_LOCATION) const; logger make_logger(); }; constexpr auto to_milliseconds(std::chrono::steady_clock::duration d) { return std::chrono::duration_cast(d).count(); } // Creates a vector of nodes from a set of RESP3 messages. // Using the raw RESP values ensures that the correct // node tree is built, which is not always obvious std::vector nodes_from_resp3( const std::vector& msgs, source_location loc = BOOST_CURRENT_LOCATION); } // namespace boost::redis::detail #endif // BOOST_REDIS_TEST_SANSIO_UTILS_HPP