<commit_before>#include "catch/single_include/catch.hpp"

#include "../include/twistedcpp/reactor.hpp"
#include "../include/twistedcpp/protocols/basic_protocol.hpp"
#include "../include/twistedcpp/factories/default_factory.hpp"

#include <boost/asio/read.hpp>
#include <boost/scope_exit.hpp>

#include <vector>
#include <string>
#include <future>

using boost::asio::ip::tcp;

struct echo_protocol : twisted::basic_protocol<echo_protocol> {
    template <typename Iter>
    void on_message(Iter begin, Iter end) {
        send_message(begin, end);
    }
};

TEST_CASE("basic ssl compile test", "[ssl][reactor]") {
    twisted::reactor reac;
    auto fut = std::async(std::launch::async, [&]() {
        reac.listen_tcp(50000, twisted::default_factory<echo_protocol>());
        reac.run();
    });

    boost::asio::io_service io_service;
    tcp::socket socket(io_service);

    BOOST_SCOPE_EXIT_TPL((&reac)(&socket)) {
        reac.stop();
        if (socket.is_open()) {
            socket.close();
        }
    }
    BOOST_SCOPE_EXIT_END<commit_msg>fixed test description<commit_after>#include "catch/single_include/catch.hpp"

#include "../include/twistedcpp/reactor.hpp"
#include "../include/twistedcpp/protocols/basic_protocol.hpp"
#include "../include/twistedcpp/factories/default_factory.hpp"

#include <boost/asio/read.hpp>
#include <boost/scope_exit.hpp>

#include <vector>
#include <string>
#include <future>

using boost::asio::ip::tcp;

struct echo_protocol : twisted::basic_protocol<echo_protocol> {
    template <typename Iter>
    void on_message(Iter begin, Iter end) {
        send_message(begin, end);
    }
};

TEST_CASE("basic tcp compile test", "[tcp][reactor]") {
    twisted::reactor reac;
    auto fut = std::async(std::launch::async, [&]() {
        reac.listen_tcp(50000, twisted::default_factory<echo_protocol>());
        reac.run();
    });

    boost::asio::io_service io_service;
    tcp::socket socket(io_service);

    BOOST_SCOPE_EXIT_TPL((&reac)(&socket)) {
        reac.stop();
        if (socket.is_open()) {
            socket.close();
        }
    }
    BOOST_SCOPE_EXIT_END
{'fraction_non_alphanumeric': 0.15777042985356637, 'fraction_numerical': 0.004723665564478035, 'mean_word_length': 3.91415313225058, 'pattern_counts': {'":': 0, '<': 19, '<?xml version=': 0, '>': 19, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '2107679', 'n_tokens_mistral': 728, 'n_tokens_neox': 707, 'n_words': 113}