<commit_before><html>
<head>
<title>Core + Assertion Test Suite Runner</title>
<style type="text/css">
#log { font-size: 0.7em; }
.level_error { color: red; }
.level_warn { color: orange; }
.level_info { color: black; }
.level_debug { color: darkgray; }
</style>
<script type="text/javascript" src="../jsunity.js"></script>
<script type="text/javascript" src="assertion.js"></script>
<script type="text/javascript" src="core.js"></script>
<script type="text/javascript">
var logLines = [];

jsUnity.log.write = function (s, level) {
    logLines.push({ s: s, level: level });
};

function flushLog() {
    var html = [];
    for (var i = 0; i < logLines.length; i++) {
        var logLine = logLines[i];
        html.push("<div class=\"level_");
        html.push(logLine.level);
        html.push("\">[");
        html.push(logLine.level.toUpperCase() );
        html.push("] ");
        html.push(logLine.s);
        html.push("</div>\n");
    }
    logLines.length = 0;
    document.getElementById("log").innerHTML += html.join("");
    setTimeout(flushLog, 1000);
}

window.onload = function () {
    flushLog();

    var results = jsUnity.run(AssertionTestSuite, CoreTestSuite);
    
    var xml = [ "<?xml version=\"1.0\" encoding=\"UTF-8\"?>" ];
    
    xml.elem = function (tagName, attrs, close) {
        var out = [];
        out.$ = function (s) { this.push(s); return this; };
        out.$("<").$(tagName);
        for (var a in attrs || {}) {
            out.$(" ").$(a).$("=\"").$(attrs[a]).$("\""); // encode!!
        }
        close && out.$("/");
        out.$(">");
        this.push(out.join(""));
        return this;
    };
    
    xml.elem("testsuite", {
        errors: 0,
        failures: results.failed,
        name: results.suiteName,
        tests: results.total,
        time: results.duration
    });

    for (var i = 0; i < results.tests.length; i++) {
        var test = results.tests[i];

        xml.elem("testcase", {
            name: test.name,
            time: test.duration
        }, test.passed);

        if (!test.passed) {
            xml.elem("failure", { message: test.failureMessage });
            xml.elem("/testcase");
        }
    }

    xml.elem("/testsuite");

    document.getElementById("results").value = xml.join("\n");
    //document.getElementById("save").submit();
};
</script>
</head>
<body>
<form action="save.asp" method="post" id="save">
<textarea id="results" name="results" cols="80" rows="20"></textarea>
</form>
<div id="log"></div>
</body>
</html><commit_msg>Tweaked the XML generator a bit.<commit_after><html>
<head>
<title>Core + Assertion Test Suite Runner</title>
<style type="text/css">
#log { font-size: 0.7em; }
.level_error { color: red; }
.level_warn { color: orange; }
.level_info { color: black; }
.level_debug { color: darkgray; }
</style>
<script type="text/javascript" src="../jsunity.js"></script>
<script type="text/javascript" src="assertion.js"></script>
<script type="text/javascript" src="core.js"></script>
<script type="text/javascript">
var logLines = [];

jsUnity.log.write = function (s, level) {
    logLines.push({ s: s, level: level });
};

function flushLog() {
    var html = [];
    for (var i = 0; i < logLines.length; i++) {
        var logLine = logLines[i];
        html.push("<div class=\"level_");
        html.push(logLine.level);
        html.push("\">[");
        html.push(logLine.level.toUpperCase() );
        html.push("] ");
        html.push(logLine.s);
        html.push("</div>\n");
    }
    logLines.length = 0;
    document.getElementById("log").innerHTML += html.join("");
    setTimeout(flushLog, 1000);
}

window.onload = function () {
    flushLog();

    var results = jsUnity.run(AssertionTestSuite, CoreTestSuite);
    
    function xmlEscape(s) {
        return s.replace(/[<>&"]/g, function (c) {
            return "&"
                + { "<": "lt", ">": "gt", "&": "amp", "\"": "quot" }[c]
                + ";";
        });
    }

    var xml = [ "<?xml version=\"1.0\" encoding=\"UTF-8\"?>\n" ];

    xml.text = function (s) {
        Array.prototype.push.call(this, s);
        return this;
    };
    
    xml.elem = function (tagName, attrs, close) {
        this.text("<").text(tagName);

        for (var a in attrs || {}) {
            this.text(" ").text(a).text("=\"")
                .text(xmlEscape(String(attrs[a]))).text("\"");
        }

        close && this.text("/");
        this.text(">\n");

        return this;
    };
    
    xml.toString = function () { return this.join(""); }

    xml.elem("testsuite", {
        errors: 0,
        failures: results.failed,
        name: results.suiteName,
        tests: results.total,
        time: results.duration
    });

    for (var i = 0; i < results.tests.length; i++) {
        var test = results.tests[i];

        xml.elem("testcase", {
            name: test.name,
            time: test.duration
        }, test.passed);

        if (!test.passed) {
            xml.elem("failure", { message: test.failureMessage })
                .elem("/testcase");
        }
    }

    xml.elem("/testsuite");

    document.getElementById("results").value = xml;
    //document.getElementById("save").submit();
};
</script>
</head>
<body>
<form action="save.asp" method="post" id="save">
<textarea id="results" name="results" cols="80" rows="20"></textarea>
</form>
<div id="log"></div>
</body>
</html>
{'fraction_non_alphanumeric': 0.2064754856614246, 'fraction_numerical': 0.0062904717853839035, 'mean_word_length': 2.441120305537874, 'pattern_counts': {'":': 4, '<': 65, '<?xml version=': 2, '>': 61, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 21}, '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': '4298910', 'n_tokens_mistral': 1791, 'n_tokens_neox': 1746, 'n_words': 356}