<commit_before>#include <catch/catch.hpp>
#include <kulma/io/file.h>
#include <kulma/macros.h>
#include <kulma/os.h>

const static char* s_filePath = "unit_test_file_cpp_test_file";

TEST_CASE("File", "[file]")
{

    SECTION("Opening file for read/write")
    {
        char data[] = "this is test string";
        kulma::touch(s_filePath);

        {
            kulma::Error err;

            kulma::FileWriter writer;
            REQUIRE(writer.open(s_filePath, false, &err));

            REQUIRE(writer.write(data, sizeof(data), &err) == sizeof(data));
            writer.close();
        }

        {
            kulma::Error err;

            kulma::FileReader reader;
            REQUIRE(reader.open(s_filePath, &err));<commit_msg>add #include <string.h><commit_after>#include <catch/catch.hpp>
#include <kulma/io/file.h>
#include <kulma/macros.h>
#include <kulma/os.h>
#include <string.h>

const static char* s_filePath = "unit_test_file_cpp_test_file";

TEST_CASE("File", "[file]")
{

    SECTION("Opening file for read/write")
    {
        char data[] = "this is test string";
        kulma::touch(s_filePath);

        {
            kulma::Error err;

            kulma::FileWriter writer;
            REQUIRE(writer.open(s_filePath, false, &err));

            REQUIRE(writer.write(data, sizeof(data), &err) == sizeof(data));
            writer.close();
        }

        {
            kulma::Error err;

            kulma::FileReader reader;
            REQUIRE(reader.open(s_filePath, &err));
{'fraction_non_alphanumeric': 0.14701986754966886, 'fraction_numerical': 0.0, 'mean_word_length': 2.4263038548752833, 'pattern_counts': {'":': 0, '<': 13, '<?xml version=': 0, '>': 13, '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': '5124924', 'n_tokens_mistral': 533, 'n_tokens_neox': 514, 'n_words': 91}