<commit_before>#include <gmock/gmock.h>

#include <stringzeug/manipulation.h>


using namespace stringzeug;


class manipulation_test : public testing::Test
{
public:
    manipulation_test()
    {
    }

protected:
};

TEST_F(manipulation_test, join)
{
    std::vector<std::string> vec {"string", "to", "concatenate"};
    std::string res = join(vec, "-");

    ASSERT_EQ("string-to-concatenate", res);
}

TEST_F(manipulation_test, trim)
{
    std::string stringWithWhitespaces = "   This is a string.     ";
    std::string trim1 = trim(stringWithWhitespaces);
    std::string trim2 = trim(stringWithWhitespaces, true);

    ASSERT_EQ("This is a string.", trim1);
    ASSERT_EQ("Thisisastring.", trim2);
}

TEST_F(manipulation_test, parseArray)
{
    std::string stringArray = "(element1, element2   ,element3,element4)";
    std::vector<std::string> vec = parseArray(stringArray, 4);
    std::vector<std::string> vecComp {"element1", "element2", "element3", "element4"};

    ASSERT_EQ(vecComp, vec);
}

TEST_F(manipulation_test, split)
{
    std::string inputString = "seperate this - by-minus-  sign.-?";
    std::vector<std::string> vec = split(inputString, '-');
    std::vector<std::string> vecComp {"seperate this ", " by", "minus", "  sign.", "?"};

    ASSERT_EQ(vecComp, vec);
}<commit_msg>Add tests for iozeug:: contains, hasPrefix, hasSuffix.<commit_after>#include <gmock/gmock.h>

#include <stringzeug/manipulation.h>


using namespace stringzeug;


class manipulation_test : public testing::Test
{
public:
    manipulation_test()
    {
    }

protected:
};

TEST_F(manipulation_test, join)
{
    std::vector<std::string> vec {"string", "to", "concatenate"};
    std::string res = join(vec, "-");

    ASSERT_EQ("string-to-concatenate", res);
}

TEST_F(manipulation_test, trim)
{
    std::string stringWithWhitespaces = "   This is a string.     ";
    std::string trim1 = trim(stringWithWhitespaces);
    std::string trim2 = trim(stringWithWhitespaces, true);

    ASSERT_EQ("This is a string.", trim1);
    ASSERT_EQ("Thisisastring.", trim2);
}

TEST_F(manipulation_test, parseArray)
{
    std::string stringArray = "(element1, element2   ,element3,element4)";
    std::vector<std::string> vec = parseArray(stringArray, 4);
    std::vector<std::string> vecComp {"element1", "element2", "element3", "element4"};

    ASSERT_EQ(vecComp, vec);
}

TEST_F(manipulation_test, split)
{
    std::string inputString = "seperate this - by-minus-  sign.-?";
    std::vector<std::string> vec = split(inputString, '-');
    std::vector<std::string> vecComp {"seperate this ", " by", "minus", "  sign.", "?"};

    ASSERT_EQ(vecComp, vec);
}

TEST_F(manipulation_test, contains)
{
    std::string str = "this string contains several words.";

    ASSERT_TRUE(contains(str, "string"));
    ASSERT_TRUE(contains(str, " "));
    ASSERT_TRUE(contains(str, "this string contains several words."));
    ASSERT_TRUE(contains(str, "."));

    ASSERT_FALSE(contains(str, "not"));
    ASSERT_FALSE(contains(str, "  "));
    ASSERT_FALSE(contains(str, ","));
}

TEST_F(manipulation_test, hasPrefix)
{
    std::string str = "abc";

    ASSERT_TRUE(hasPrefix(str, "a"));
    ASSERT_TRUE(hasPrefix(str, "ab"));
    ASSERT_TRUE(hasPrefix(str, "abc"));

    ASSERT_FALSE(hasPrefix(str, "abcd"));
    ASSERT_FALSE(hasPrefix(str, "b"));
    ASSERT_FALSE(hasPrefix(str, "c"));
}

TEST_F(manipulation_test, hasSuffix)
{
    std::string str = "abc";

    ASSERT_TRUE(hasSuffix(str, "c"));
    ASSERT_TRUE(hasSuffix(str, "bc"));
    ASSERT_TRUE(hasSuffix(str, "abc"));

    ASSERT_FALSE(hasSuffix(str, "a"));
    ASSERT_FALSE(hasSuffix(str, "b"));
    ASSERT_FALSE(hasSuffix(str, "ab"));
    ASSERT_FALSE(hasSuffix(str, "d"));
}
{'fraction_non_alphanumeric': 0.1709816612729234, 'fraction_numerical': 0.007011866235167206, 'mean_word_length': 4.679938744257274, 'pattern_counts': {'":': 0, '<': 17, '<?xml version=': 0, '>': 17, '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': '4620945', 'n_tokens_mistral': 1311, 'n_tokens_neox': 1284, 'n_words': 239}