<commit_before>#include "../src/EscapeCodeGenerator.hpp"
#include "catch.hpp"

void testEscapeCodeWithNumber(const std::string &result, int n, char c) {
    std::string compare{"\033["};
    compare += std::to_string(n);
    compare += c;
    REQUIRE(result == compare); 
}

TEST_CASE( "does not generate escape code for moving forward by 0", "[ANSIEscapeCodeGenerator.nullMoveForward]") {
    ANSIEscapeCodeGenerator gen;
    auto result = gen.cursorForward(0);
    REQUIRE(result == "");
}

TEST_CASE( "can generate proper escape codes for moving forward", "[ANSIEscapeCodeGenerator.movingForward]") {
    ANSIEscapeCodeGenerator gen;
    for (int i = 1; i < 100; i++) {
        testEscapeCodeWithNumber(gen.cursorForward(i), i, 'C');
    }
}

TEST_CASE( "does not generate escape code for moving backward by 0", "[ANSIEscapeCodeGenerator.nullMoveBackward]") {
    ANSIEscapeCodeGenerator gen;
    auto result = gen.cursorBackward(0);
    REQUIRE(result == "");
}

TEST_CASE( "can generate proper escape codes for moving backward", "[ANSIEscapeCodeGenerator.movingBackward]") {
    ANSIEscapeCodeGenerator gen;
    for (int i = 1; i < 100; i++) {
        testEscapeCodeWithNumber(gen.cursorBackward(i), i, 'D');
    }
}

TEST_CASE( "generates proper escape code for clearing the line", "ANSIEscapeCodeGenerator.clearTerminalLine") {
    ANSIEscapeCodeGenerator gen;
    auto result = gen.clearTerminalLine();
    REQUIRE(result == "\033[K");
}

TEST_CASE( "generates proper escape codes for colors", "ANSIEscapeCodeGenerator.colors") {
    ANSIEscapeCodeGenerator gen;
    for (int i = 0; i < 100; i++) {
        testEscapeCodeWithNumber(gen.setColor(static_cast<Color>(i)), i, 'm');<commit_msg>Change the range of testing colors<commit_after>#include "../src/EscapeCodeGenerator.hpp"
#include "catch.hpp"

void testEscapeCodeWithNumber(const std::string &result, int n, char c) {
    std::string compare{"\033["};
    compare += std::to_string(n);
    compare += c;
    REQUIRE(result == compare); 
}

TEST_CASE( "does not generate escape code for moving forward by 0", "[ANSIEscapeCodeGenerator.nullMoveForward]") {
    ANSIEscapeCodeGenerator gen;
    auto result = gen.cursorForward(0);
    REQUIRE(result == "");
}

TEST_CASE( "can generate proper escape codes for moving forward", "[ANSIEscapeCodeGenerator.movingForward]") {
    ANSIEscapeCodeGenerator gen;
    for (int i = 1; i < 100; i++) {
        testEscapeCodeWithNumber(gen.cursorForward(i), i, 'C');
    }
}

TEST_CASE( "does not generate escape code for moving backward by 0", "[ANSIEscapeCodeGenerator.nullMoveBackward]") {
    ANSIEscapeCodeGenerator gen;
    auto result = gen.cursorBackward(0);
    REQUIRE(result == "");
}

TEST_CASE( "can generate proper escape codes for moving backward", "[ANSIEscapeCodeGenerator.movingBackward]") {
    ANSIEscapeCodeGenerator gen;
    for (int i = 1; i < 100; i++) {
        testEscapeCodeWithNumber(gen.cursorBackward(i), i, 'D');
    }
}

TEST_CASE( "generates proper escape code for clearing the line", "ANSIEscapeCodeGenerator.clearTerminalLine") {
    ANSIEscapeCodeGenerator gen;
    auto result = gen.clearTerminalLine();
    REQUIRE(result == "\033[K");
}

TEST_CASE( "generates proper escape codes for colors", "ANSIEscapeCodeGenerator.colors") {
    ANSIEscapeCodeGenerator gen;
    for (int i = 0; i < 98; i++) {
        testEscapeCodeWithNumber(gen.setColor(static_cast<Color>(i)), i, 'm');
{'fraction_non_alphanumeric': 0.13005272407732865, 'fraction_numerical': 0.012595196250732278, 'mean_word_length': 4.508064516129032, 'pattern_counts': {'":': 0, '<': 11, '<?xml version=': 0, '>': 5, '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': '7298705', 'n_tokens_mistral': 1127, 'n_tokens_neox': 1083, 'n_words': 278}