<commit_before>let piped_channel () =
    let pipe_read, pipe_write = Unix.pipe()
    in
        (Unix.in_channel_of_descr pipe_read), (Unix.out_channel_of_descr pipe_write);; 

let test_read_string () =
    let test_pipe_read, test_pipe_write = piped_channel()
    in
    begin
        output_string test_pipe_write "test string\r\n";
        flush test_pipe_write;
        assert (
            Redis.read_string test_pipe_read
            = "test string"
        )
    end;;

let test_send_and_receive_command () =
    let test_input_read, test_input_write = piped_channel()
    in
    let test_output_read, test_output_write = piped_channel()
    in
        begin
            output_string test_input_write "+bar\r\n";
            flush test_input_write;
            let result = Redis.send_and_receive_command "foo" (test_input_read, test_output_write)
            in
            begin
                assert ( "foo\r" = (input_line test_output_read) );
                assert ( Redis.Status("bar") = result )<commit_msg>Have test for error case for send_and_receive_command<commit_after>let piped_channel () =
    let pipe_read, pipe_write = Unix.pipe()
    in
        (Unix.in_channel_of_descr pipe_read), (Unix.out_channel_of_descr pipe_write);; 

let test_read_string () =
    let test_pipe_read, test_pipe_write = piped_channel()
    in
    begin
        output_string test_pipe_write "test string\r\n";
        flush test_pipe_write;
        assert (
            Redis.read_string test_pipe_read
            = "test string"
        )
    end;;

let test_send_and_receive_command () =
    let test_input_read, test_input_write = piped_channel()
    in
    let test_output_read, test_output_write = piped_channel()
    in
        begin
            begin
                output_string test_input_write "+bar\r\n";
                flush test_input_write;
                let result = Redis.send_and_receive_command "foo" (test_input_read, test_output_write)
                in
                begin
                    assert ( "foo\r" = (input_line test_output_read) );
                    assert ( Redis.Status("bar") = result )
                end
            end;
            begin
                output_string test_input_write "fail\r\n";
                flush test_input_write;
                let result = Redis.send_and_receive_command "foo" (test_input_read, test_output_write)
                in
                begin
                    assert ( "foo\r" = (input_line test_output_read) );
                    assert ( Redis.Error = result )
                end
{'fraction_non_alphanumeric': 0.07486423584173778, 'fraction_numerical': 0.0, 'mean_word_length': 1.9918793503480279, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 3, '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': '4841716', 'n_tokens_mistral': 798, 'n_tokens_neox': 769, 'n_words': 159}