<commit_before>// == The functional tests ==
// The following tests verify that manipulating a certain series of knobs will 
// # have the desired effect
// # will always have this effect even ten releases later.
var functionalTest = function(keys, writo){
    var doc = document.getElementsByTagName("body")[0];

    fireunit.compare(
        "|",
        $("#DocumentContainer").text(),
        "Test if document is empty, except for cursor"
    );

    fireunit.key(doc, "u");//insert mode
    fireunit.compare(
        false, 
        writo.commandInProgress,
        "Pressing undo when nothing is done yet, should gracefully fail, by doing nothing"
    );
    
    fireunit.key(doc, "r");//insert mode
    fireunit.compare(
        false, 
        writo.commandInProgress,
        "Pressing redo when nothing is done yet, should gracefully fail, by doing nothing"
    );
    
    fireunit.key(doc, "i");//insert mode
    fireunit.ok(
        $("body").hasClass("insert"), 
        "Pressing 'i' puts writo in insert mode"
    );
    fireunit.key(doc, keys.esc);//command mode
    fireunit.ok(
        $("body").hasClass("command"), 
        "Pressing 'esc' puts writo back in command mode"
    );
    
    fireunit.compare(
        "|",
        $("#DocumentContainer").text(),
        "Switching shouldn't change the document"
    );
    fireunit.key(doc, "i");//insert mode
    fireunit.key(doc, "t");
    fireunit.key(doc, "e");
    fireunit.key(doc, "s");
    fireunit.key(doc, "t");
    fireunit.key(doc, keys.esc);//command mode
    fireunit.compare(
        "test|",
        $("#DocumentContainer").text(),
        "Adding text works"
    );
    fireunit.key(doc, "u");//undo
    fireunit.key(doc, "u");//undo
    fireunit.key(doc, "u");//undo
    fireunit.compare(
        "t|",
        $("#DocumentContainer").text(),
        "Undoing multiple times works"
    );
    fireunit.key(doc, "r");//redo
    fireunit.key(doc, "r");//redo
    fireunit.compare(
        "tes|",
        $("#DocumentContainer").text(),
        "Redoing multiple times works"
    );
    
    fireunit.key(doc, "u");//undo
    fireunit.key(doc, "i");//insert mode
    fireunit.key(doc, "r");
    fireunit.key(doc, "u");
    fireunit.key(doc, "g");
    fireunit.key(doc, "k");
    fireunit.key(doc, keys.esc);
    fireunit.key(doc, "u");//undo
    
    fireunit.compare(
        "terug|",
        $("#DocumentContainer").text(),
        "Undoing, then adding new commands, then undoing again"
    );
    
    fireunit.key(doc, "2");
    fireunit.key(doc, "h");
    fireunit.compare(
        "ter|ug",
        $("#DocumentContainer").text(),
        "Doing a combo command, resulting in two left presses"
    );
    
    fireunit.key(doc, "l");
    fireunit.compare(
        "teru|g",
        $("#DocumentContainer").text(),
        "Pressing the right cursor once"
    );

    fireunit.key(doc, "l");
    fireunit.key(doc, "l");
    fireunit.key(doc, "i");//insert mode
    fireunit.key(doc, " ");
    fireunit.key(doc, keys.esc);
    fireunit.compare(
        "terug |",
        $("#DocumentContainer").text(),
        "Walking past the end of the text fails gracefully"
    );
    fireunit.key(doc, "x");
    fireunit.compare(
        "terug|",
        $("#DocumentContainer").text(),
        "Characters can be deleted"
    );

    fireunit.key(doc, "u");
    fireunit.compare(
        "terug |",
        $("#DocumentContainer").text(),
        "Delete can be undone"
    );

    
    fireunit.key(doc, "b");
    fireunit.ok(
        $("#DocumentContainer > div").hasClass("heading"), 
        "Pressing 'b' will apply the style 'heading' to the current paragraph"
    );

    fireunit.key(doc, "u");
    fireunit.ok(
        !$("#DocumentContainer > div").hasClass("heading"), 
        "Setting heading can be undone"
    );

    fireunit.key(doc, "x");
    fireunit.key(doc, ".");
    fireunit.compare(
        "teru|",
        $("#DocumentContainer").text(),
        "Reperform the last command by pressing the '.'"
    );
    
    fireunit.key(doc, "2");
    fireunit.key(doc, "x");
    fireunit.key(doc, "u");
    fireunit.compare(
        "teru|",<commit_msg>Changed use of command multiplier.<commit_after>// == The functional tests ==
// The following tests verify that manipulating a certain series of knobs will 
// # have the desired effect
// # will always have this effect even ten releases later.
var functionalTest = function(keys, writo){
    var doc = document.getElementsByTagName("body")[0];

    fireunit.compare(
        "|",
        $("#DocumentContainer").text(),
        "Test if document is empty, except for cursor"
    );

    fireunit.key(doc, "u");//insert mode
    fireunit.compare(
        false, 
        writo.commandInProgress,
        "Pressing undo when nothing is done yet, should gracefully fail, by doing nothing"
    );
    
    fireunit.key(doc, "r");//insert mode
    fireunit.compare(
        false, 
        writo.commandInProgress,
        "Pressing redo when nothing is done yet, should gracefully fail, by doing nothing"
    );
    
    fireunit.key(doc, "i");//insert mode
    fireunit.ok(
        $("body").hasClass("insert"), 
        "Pressing 'i' puts writo in insert mode"
    );
    fireunit.key(doc, keys.esc);//command mode
    fireunit.ok(
        $("body").hasClass("command"), 
        "Pressing 'esc' puts writo back in command mode"
    );
    
    fireunit.compare(
        "|",
        $("#DocumentContainer").text(),
        "Switching shouldn't change the document"
    );
    fireunit.key(doc, "i");//insert mode
    fireunit.key(doc, "t");
    fireunit.key(doc, "e");
    fireunit.key(doc, "s");
    fireunit.key(doc, "t");
    fireunit.key(doc, keys.esc);//command mode
    fireunit.compare(
        "test|",
        $("#DocumentContainer").text(),
        "Adding text works"
    );
    fireunit.key(doc, "u");//undo
    fireunit.key(doc, "u");//undo
    fireunit.key(doc, "u");//undo
    fireunit.compare(
        "t|",
        $("#DocumentContainer").text(),
        "Undoing multiple times works"
    );
    fireunit.key(doc, "r");//redo
    fireunit.key(doc, "r");//redo
    fireunit.compare(
        "tes|",
        $("#DocumentContainer").text(),
        "Redoing multiple times works"
    );
    
    fireunit.key(doc, "u");//undo
    fireunit.key(doc, "i");//insert mode
    fireunit.key(doc, "r");
    fireunit.key(doc, "u");
    fireunit.key(doc, "g");
    fireunit.key(doc, "k");
    fireunit.key(doc, keys.esc);
    fireunit.key(doc, "u");//undo
    
    fireunit.compare(
        "terug|",
        $("#DocumentContainer").text(),
        "Undoing, then adding new commands, then undoing again"
    );
    
    fireunit.key(doc, "h");
    fireunit.key(doc, "1");
    fireunit.compare(
        "ter|ug",
        $("#DocumentContainer").text(),
        "Doing a combo command, resulting in two left presses"
    );
    
    fireunit.key(doc, "l");
    fireunit.compare(
        "teru|g",
        $("#DocumentContainer").text(),
        "Pressing the right cursor once"
    );

    fireunit.key(doc, "l");
    fireunit.key(doc, "l");
    fireunit.key(doc, "i");//insert mode
    fireunit.key(doc, " ");
    fireunit.key(doc, keys.esc);
    fireunit.compare(
        "terug |",
        $("#DocumentContainer").text(),
        "Walking past the end of the text fails gracefully"
    );
    fireunit.key(doc, "x");
    fireunit.compare(
        "terug|",
        $("#DocumentContainer").text(),
        "Characters can be deleted"
    );

    fireunit.key(doc, "u");
    fireunit.compare(
        "terug |",
        $("#DocumentContainer").text(),
        "Delete can be undone"
    );

    
    fireunit.key(doc, "b");
    fireunit.ok(
        $("#DocumentContainer > div").hasClass("heading"), 
        "Pressing 'b' will apply the style 'heading' to the current paragraph"
    );

    fireunit.key(doc, "u");
    fireunit.ok(
        !$("#DocumentContainer > div").hasClass("heading"), 
        "Setting heading can be undone"
    );

    fireunit.key(doc, "x");
    fireunit.key(doc, "1");
    fireunit.compare(
        "teru|",
        $("#DocumentContainer").text(),
        "Reperform the last command by pressing the '.'"
    );
    
    fireunit.key(doc, "x");
    fireunit.key(doc, "2");
    fireunit.key(doc, "u");
    fireunit.compare(
        "teru|",
{'fraction_non_alphanumeric': 0.16716704695568632, 'fraction_numerical': 0.0008406388855530203, 'mean_word_length': 2.3540072492952073, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 7, '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': '2539244', 'n_tokens_mistral': 2659, 'n_tokens_neox': 2641, 'n_words': 606}