<commit_before>var OrderedSet = Chorus.OrderedSet;

test("Initialized with an ordered, uniquified Array", function () {
    var set = new OrderedSet([1, 2, 3, 4, 5]);

    same( set.toArray(), [1, 2, 3, 4, 5], "OrderedSet::toArray");
    equals( set.item(0), 1, "OrderedSet::item");
    ok( set.contains(1),   "OrderedSet::contains");
    equals( set.length, 5,  "OrderedSet::length");
});

test("Initialized with an unsorted Array", function () {
    var set = new OrderedSet([1, 4, 3, 2, 5]);

    same( set.toArray(), [1, 2, 3, 4, 5], "OrderedSet::toArray");
    equals( set.item(0), 1, "OrderedSet::item");
    ok( set.contains(1),   "OrderedSet::contains");
    equals( set.length, 5,  "OrderedSet::length");
});

test("Initialized with an Array containing duplicates", function () {
    var set = new OrderedSet([1, 2, 2, 2, 3, 4, 5, 5, 5, 5]);

    same( set.toArray(), [1, 2, 3, 4, 5], "OrderedSet::toArray");
    equals( set.item(0), 1, "OrderedSet::item");
    ok( set.contains(1),   "OrderedSet::contains");
    equals( set.length, 5,  "OrderedSet::length");
});

test("Initialized with an unordered Array containing duplicates", function () {
    var set = new OrderedSet([3, 1, 2, 4, 5, 2, 5, 2, 5, 5]);

    same( set.toArray(), [1, 2, 3, 4, 5], "OrderedSet::toArray");
    equals( set.item(0), 1, "OrderedSet::item");
    ok( set.contains(1),   "OrderedSet::contains");
    equals( set.length, 5,  "OrderedSet::length");
});


test("Initialized with and Array, and called OrderedSet::concat", function () {
    var set = new OrderedSet([1, 2, 3]).concat([4, 5]);

    same( set.toArray(), [1, 2, 3, 4, 5], "OrderedSet::toArray");
    equals( set.item(0), 1, "OrderedSet::item");
    ok( set.contains(1),    "OrderedSet::contains");
    equals( set.length, 5,  "OrderedSet::length");

    ok( set.concat([5])  === set,  "OrderedSet::concat() will return identity");
    ok( set.concat([11]) !== set, "OrderedSet::concat() will return identity");
});

test("ordering statuses", function () {
    var ls = new OrderedSet(test_tweets),
        i, j, l = ls.length;

    for (i = 0; i + 1 < l; i++) {
        for (j = 1; i + j < l; j++) {
            ok(ls.items[i + j].__gt__(ls.items[i]), ("item[" + (i + j) + "] > item[" + i + "]"));
            ok(!ls.items[i].__gt__(ls.items[i + j]), ("!item[" + i + "] > item[" + (i + j) + "]"));
            ok(!ls.items[i].__eq__(ls.items[i + j]) && !ls.items[i + j].__eq__(ls.items[i]),
               ("item[" + i + "] !== item[" + (i + j) + "]"));
        }
    }
});<commit_msg>made ordered set use a reasonable number of tests<commit_after>var OrderedSet = Chorus.OrderedSet;

test("Initialized with an ordered, uniquified Array", function () {
    var set = new OrderedSet([1, 2, 3, 4, 5]);

    same( set.toArray(), [1, 2, 3, 4, 5], "OrderedSet::toArray");
    equals( set.item(0), 1, "OrderedSet::item");
    ok( set.contains(1),   "OrderedSet::contains");
    equals( set.length, 5,  "OrderedSet::length");
});

test("Initialized with an unsorted Array", function () {
    var set = new OrderedSet([1, 4, 3, 2, 5]);

    same( set.toArray(), [1, 2, 3, 4, 5], "OrderedSet::toArray");
    equals( set.item(0), 1, "OrderedSet::item");
    ok( set.contains(1),   "OrderedSet::contains");
    equals( set.length, 5,  "OrderedSet::length");
});

test("Initialized with an Array containing duplicates", function () {
    var set = new OrderedSet([1, 2, 2, 2, 3, 4, 5, 5, 5, 5]);

    same( set.toArray(), [1, 2, 3, 4, 5], "OrderedSet::toArray");
    equals( set.item(0), 1, "OrderedSet::item");
    ok( set.contains(1),   "OrderedSet::contains");
    equals( set.length, 5,  "OrderedSet::length");
});

test("Initialized with an unordered Array containing duplicates", function () {
    var set = new OrderedSet([3, 1, 2, 4, 5, 2, 5, 2, 5, 5]);

    same( set.toArray(), [1, 2, 3, 4, 5], "OrderedSet::toArray");
    equals( set.item(0), 1, "OrderedSet::item");
    ok( set.contains(1),   "OrderedSet::contains");
    equals( set.length, 5,  "OrderedSet::length");
});


test("Initialized with and Array, and called OrderedSet::concat", function () {
    var set = new OrderedSet([1, 2, 3]).concat([4, 5]);

    same( set.toArray(), [1, 2, 3, 4, 5], "OrderedSet::toArray");
    equals( set.item(0), 1, "OrderedSet::item");
    ok( set.contains(1),    "OrderedSet::contains");
    equals( set.length, 5,  "OrderedSet::length");

    ok( set.concat([5])  === set,  "OrderedSet::concat() will return identity");
    ok( set.concat([11]) !== set, "OrderedSet::concat() will return identity");
});

test("Ordering statuses", function () {
    var ls = new OrderedSet(test_tweets),
        i, j, k, l = ls.length,

        correct_order = true,
        no_dupes = true;

    for (i = 0; i + 1 < l; i++) {
        for (j = 1; i + j < l; j++) {
            k = i + j; // k and i are valid indexes, and k > i
            if (// test that item[k] > item[i] 
                !ls.items[k].__gt__(ls.items[i]) ||
                // test that !(item[i] > item[k])
                ls.items[i].__gt__(ls.items[k])) {
                correct_order = false;
            }

            if (ls.items[i].__eq__(ls.items[k]) || ls.items[k].__eq__(ls.items[i])){
                no_dupes = false;
            }
        }
    }

    ok(correct_order, "Correct order");
    ok(no_dupes, "No duplicates");
});
{'fraction_non_alphanumeric': 0.21101949025487257, 'fraction_numerical': 0.03223388305847077, 'mean_word_length': 3.143633540372671, 'pattern_counts': {'":': 0, '<': 7, '<?xml version=': 0, '>': 8, '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': '6090599', 'n_tokens_mistral': 2077, 'n_tokens_neox': 1915, 'n_words': 516}