<commit_before>module minerva.tests.mock {
    export function createTree (outItems?: layout.Updater[]) {
        var root = new layout.Updater();

        var child1 = new layout.Updater();
        var gchild1 = new layout.Updater();
        var gchild2 = new layout.Updater();
        var gchild3 = new layout.Updater();

        var child2 = new layout.Updater();
        var gchild4 = new layout.Updater();
        var ggchild1 = new layout.Updater();

        connect(root, [child1, child2]);
        connect(child1, [gchild1, gchild2, gchild3]);
        connect(child2, [gchild4]);
        connect(gchild4, [ggchild1]);

        if (outItems)
            outItems.push(root, child1, gchild1, gchild2, gchild3, child2, gchild4, ggchild1);

        return root;
    }

    function connect (parent: layout.Updater, children: layout.Updater[]) {
        children.forEach(c => c.setVisualParent(parent));
        parent.walk = (dir?: WalkDirection): IWalker<layout.Updater> => {
            var isReverse = dir === WalkDirection.Reverse || dir === WalkDirection.ZReverse;
            var i = isReverse ? children.length : -1;
            return {
                current: undefined,
                step: function (): boolean {
                    (isReverse) ? i-- : i++;
                    this.current = children[i];
                    return this.current !== undefined;
                }
            };
        };
        return this;
    }

    QUnit.module("mock");

    QUnit.test("walkDeep", (assert) => {
        var expected: layout.Updater[] = [];
        var root = createTree(expected);
        var i = 0;
        for (var walker = root.walkDeep(); walker.step(); i++) {
            assert.strictEqual(walker.current, expected[i]);
        }
        assert.strictEqual(i, 8);
    });

    QUnit.test("walkDeep reverse", (assert) => {
        var expected: layout.Updater[] = [];
        var root = createTree(expected);
        expected = [expected[0], expected[5], expected[6], expected[7], expected[1], expected[4], expected[3], expected[2]];
        var i = 0;
        for (var walker = root.walkDeep(WalkDirection.Reverse); walker.step(); i++) {
            assert.strictEqual(walker.current, expected[i]);
        }
        assert.strictEqual(i, 8);
    });
}<commit_msg>Added test for skipBranch.<commit_after>module minerva.tests.mock {
    export function createTree (outItems?: layout.Updater[]) {
        var root = new layout.Updater();

        var child1 = new layout.Updater();
        var gchild1 = new layout.Updater();
        var gchild2 = new layout.Updater();
        var gchild3 = new layout.Updater();

        var child2 = new layout.Updater();
        var gchild4 = new layout.Updater();
        var ggchild1 = new layout.Updater();

        connect(root, [child1, child2]);
        connect(child1, [gchild1, gchild2, gchild3]);
        connect(child2, [gchild4]);
        connect(gchild4, [ggchild1]);

        if (outItems)
            outItems.push(root, child1, gchild1, gchild2, gchild3, child2, gchild4, ggchild1);

        return root;
    }

    function connect (parent: layout.Updater, children: layout.Updater[]) {
        children.forEach(c => c.setVisualParent(parent));
        parent.walk = (dir?: WalkDirection): IWalker<layout.Updater> => {
            var isReverse = dir === WalkDirection.Reverse || dir === WalkDirection.ZReverse;
            var i = isReverse ? children.length : -1;
            return {
                current: undefined,
                step: function (): boolean {
                    (isReverse) ? i-- : i++;
                    this.current = children[i];
                    return this.current !== undefined;
                }
            };
        };
        return this;
    }

    QUnit.module("mock");

    QUnit.test("walkDeep", (assert) => {
        var expected: layout.Updater[] = [];
        var root = createTree(expected);
        var i = 0;
        for (var walker = root.walkDeep(); walker.step(); i++) {
            assert.strictEqual(walker.current, expected[i]);
        }
        assert.strictEqual(i, 8);
    });

    QUnit.test("walkDeep reverse", (assert) => {
        var expected: layout.Updater[] = [];
        var root = createTree(expected);
        expected = [expected[0], expected[5], expected[6], expected[7], expected[1], expected[4], expected[3], expected[2]];
        var i = 0;
        for (var walker = root.walkDeep(WalkDirection.Reverse); walker.step(); i++) {
            assert.strictEqual(walker.current, expected[i]);
        }
        assert.strictEqual(i, 8);
    });

    QUnit.test("walkDeep skipBranch", (assert) => {
        var expected: layout.Updater[] = [];
        var root = createTree(expected);
        expected[1].assets.visibility = Visibility.Collapsed;
        var i = 0;
        for (var walker = root.walkDeep(); walker.step();) {
            if (walker.current.assets.visibility === Visibility.Collapsed) {
                walker.skipBranch();
                continue;
            }
            i++;
        }
        assert.strictEqual(i, 4);
    });
}
{'fraction_non_alphanumeric': 0.13768115942028986, 'fraction_numerical': 0.014683447749809305, 'mean_word_length': 1.9058171745152355, 'pattern_counts': {'":': 0, '<': 5, '<?xml version=': 0, '>': 14, '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': '2597232', 'n_tokens_mistral': 1551, 'n_tokens_neox': 1489, 'n_words': 338}