<commit_before>
#define    TEST_CASE

#include <boost/thread/thread.hpp>
#include <boost/test/included/unit_test.hpp>

#include "tcp_ssl_socket.h"
#include "wrlock.h"
#include "logger.h"

#define DUMMI_SERVER_IP     "127.0.0.1"
#define DUMMI_SERVER_PORT     7000

using namespace boost::unit_test_framework;

// dummy client
class test_client{
    public:
        // 
        test_client(boost::asio::io_service& io_service, boost::asio::ssl::context& context) :
            my_socket(io_service,context){
        };

        ~test_client(){
        };
        void all_lock(){
            
            //! socket connect mutex
            connect_mutex.wrlock();
            //! socket handshake mutex
            handshake_mutex.wrlock();
            //! socket read mutex
            read_mutex.wrlock();
            //! socket write mutex
            write_mutex.wrlock();
            //! socket close mutex
            close_mutex.wrlock();

        }


        void handshake_test_run(){
            // dummy client start

            // connect
            {
                l7vs::rw_scoped_lock scope_lock(connect_mutex);

                if(!connect_test()){
                    return;
                }
            }

            // handshake
            {
                l7vs::rw_scoped_lock scope_lock(handshake_mutex);

                if(!handshake_test()){
                    return;
                }
            }
/*
            // send
            {
                l7vs::rw_scoped_lock scope_lock(write_mutex);
                if(!send_test()){
                    close_test();
                    return;
                }
            }
            // receive
            {
                l7vs::rw_scoped_lock scope_lock(read_mutex);
                if(!receive_test()){
                    close_test();
                    return;
                }
            }
*/
            // close 
            {
                l7vs::rw_scoped_lock scope_lock(close_mutex);
                close_test();
            }

        };

        bool connect_test(){
            sleep(1);
            boost::system::error_code ec;
            boost::asio::ip::tcp::endpoint connect_end(boost::asio::ip::address::from_string(DUMMI_SERVER_IP), DUMMI_SERVER_PORT);
            my_socket.lowest_layer().connect(connect_end,ec);
            if(ec){
                //receive error
                std::cout << "dummy client connect Error!" << std::endl;
                std::cout << ec << std::endl;
                return false;
            }
            std::cout << "dummy client connect OK" << std::endl;
            return true;
        };

        bool handshake_test(){
            sleep(1);
            boost::system::error_code ec;
            my_socket.handshake(boost::asio::ssl::stream_base::client, ec);
            if(ec){
                //receive error
                std::cout << "dummy client handshake Error!" << std::endl;
                std::cout << ec << std::endl;
                return false;
            }
            std::cout << "dummy client handshake OK" << std::endl;
            return true;
        };

        bool send_test(){
            sleep(1);
            boost::system::error_code ec;
            my_socket.write_some(boost::asio::buffer(request,MAX_BUFFER_SIZE), ec);
            if(ec){
                //receive error
                std::cout << "dummy client send Error!" << std::endl;
                std::cout << ec << std::endl;
                return false;
            }
            std::cout << "dummy client send OK" << std::endl;<commit_msg>テストコード修正<commit_after>
#define    TEST_CASE

#include <boost/thread/thread.hpp>
#include <boost/test/included/unit_test.hpp>

#include "tcp_ssl_socket.h"
#include "wrlock.h"
#include "logger.h"

#define DUMMI_SERVER_IP     "127.0.0.1"
#define DUMMI_SERVER_PORT     7000

using namespace boost::unit_test_framework;

// dummy client
class test_client{
    public:
        // 
        test_client(boost::asio::io_service& io_service, boost::asio::ssl::context& context) :
            my_socket(io_service,context){
        };

        ~test_client(){
        };
        void all_lock(){
            
            //! socket connect mutex
            connect_mutex.wrlock();
            //! socket handshake mutex
            handshake_mutex.wrlock();
            //! socket read mutex
            read_mutex.wrlock();
            //! socket write mutex
            write_mutex.wrlock();
            //! socket close mutex
            close_mutex.wrlock();

        }


        void handshake_test_run(){
            // dummy client start

            // connect
            {
                l7vs::rw_scoped_lock scope_lock(connect_mutex);

                if(!connect_test()){
                    return;
                }
            }

            // handshake
            {
                l7vs::rw_scoped_lock scope_lock(handshake_mutex);

                if(!handshake_test()){
                    return;
                }
            }
/*
            // send
            {
                l7vs::rw_scoped_lock scope_lock(write_mutex);
                if(!send_test()){
                    close_test();
                    return;
                }
            }
            // receive
            {
                l7vs::rw_scoped_lock scope_lock(read_mutex);
                if(!receive_test()){
                    close_test();
                    return;
                }
            }
*/
            // close 
            {
                l7vs::rw_scoped_lock scope_lock(close_mutex);
                close_test();
            }

        };

        bool connect_test(){
            sleep(1);
            boost::system::error_code ec;
            boost::asio::ip::tcp::endpoint connect_end(boost::asio::ip::address::from_string(DUMMI_SERVER_IP), DUMMI_SERVER_PORT);
            my_socket.lowest_layer().connect(connect_end,ec);
            if(ec){
                //receive error
                std::cout << "dummy client connect Error!" << std::endl;
                std::cout << ec << std::endl;
                return false;
            }
            std::cout << "dummy client connect OK" << std::endl;
            return true;
        };

        bool handshake_test(){
//            sleep(1);
            boost::system::error_code ec;
            my_socket.handshake(boost::asio::ssl::stream_base::client, ec);
            if(ec){
                //receive error
                std::cout << "dummy client handshake Error!" << std::endl;
                std::cout << ec << std::endl;
                return false;
            }
            std::cout << "dummy client handshake OK" << std::endl;
            return true;
        };

        bool send_test(){
            sleep(1);
            boost::system::error_code ec;
            my_socket.write_some(boost::asio::buffer(request,MAX_BUFFER_SIZE), ec);
            if(ec){
                //receive error
                std::cout << "dummy client send Error!" << std::endl;
                std::cout << ec << std::endl;
                return false;
            }
            std::cout << "dummy client send OK" << std::endl;
{'fraction_non_alphanumeric': 0.11692820441605332, 'fraction_numerical': 0.004999305651992779, 'mean_word_length': 1.3120385232744782, 'pattern_counts': {'":': 0, '<': 79, '<?xml version=': 0, '>': 7, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 2, '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': '679379', 'n_tokens_mistral': 2013, 'n_tokens_neox': 1888, 'n_words': 345}