<commit_before>import {
    bigger, intersect, removeFrom, smaller, subtractTwo, takeUntil,
    takeWhile, flow, map, times, filter, isNot, sameAs, differentFrom, includedIn
} from '../../../app/util/list-util';

/**
 * @author <NAME>
 */
export function main() {

    describe('ListUtil', () => {

        it('intersect - intersection',() => {

            expect(intersect([[1,2],[2,3],[2,4]])).toEqual([2]);
        });


        it('intersect - no intersection',() => {

            expect(intersect([[1,2],[3,4],[5,6]])).toEqual([]);
        });


        it('intersect - no intersection where only partial intersection',() => {

            expect(intersect([[1,2],[2,3],[3,4]])).toEqual([]);
        });


        it('subtractTwo',() => {

            expect(subtractTwo([[1,2],[2,2]],[1,2,3,4])).toEqual([3,4]);
        });


        it('take five', () =>

            expect(takeWhile(smaller(20))
                ([7, 9, 10, 13, 17, 20])).toEqual([7, 9, 10, 13, 17])
        );


        it('take none', () =>

            expect(takeWhile(bigger(23))
                ([7, 9, 10, 13, 17, 20])).toEqual([])
        );


        it('take all', () =>

            expect(takeWhile(bigger(1))
                ([7, 9])).toEqual([7, 9])
        );


        it('empty', () =>

            expect(takeWhile(bigger(23))
                ([])).toEqual([])
        );


        it('until: take two', () => {

            expect(takeUntil(bigger(7))
                ([7, 9, 11])).toEqual([7, 9]);
        });


        it('until: take all', () =>

            expect(takeUntil(bigger(13))
                ([7, 9, 11])).toEqual([7, 9, 11])
        );


        it('until: empty', () =>

            expect(takeUntil(bigger(13))
                ([])).toEqual([])
        );


        it('removeFrom', () =>

            expect(removeFrom([1,2,13,13,4])(13)).toEqual([1,2,4])
        );


        it('removeFrom: nothing', () =>

            expect(removeFrom([1,2,7,4])(13)).toEqual([1,2,7,4])
        );


        it('removeFrom: everything', () =>

            expect(removeFrom([1,1])(1)).toEqual([])
        );


        it('times', () =>

            expect(times(2)
                (2)).toEqual(4)
        );


        it('map', () =>

            expect(map(times(2))
                ([2,4])).toEqual(([4,8]))
        );


        it('filter', () =>

            expect(filter(smaller(4))
                ([2,4,1,5,7,8,2,1,0])).toEqual(([2,1,2,1,0]))
        );


        fit('flow', () =>

            expect(flow(
                    takeWhile(bigger(4)),
                    map(times(2)),
                    filter(smaller(16)),<commit_msg>Add tests for subtract<commit_after>import {
    bigger, intersect, removeFrom, smaller, subtractTwo, takeUntil,
    takeWhile, flow, map, times, filter, isNot, sameAs, differentFrom, includedIn, subtract
} from '../../../app/util/list-util';

/**
 * @author <NAME>
 */
export function main() {

    describe('ListUtil', () => {

        it('intersect - intersection',() => {

            expect(intersect([[1,2],[2,3],[2,4]])).toEqual([2]);
        });


        it('intersect - no intersection',() => {

            expect(intersect([[1,2],[3,4],[5,6]])).toEqual([]);
        });


        it('intersect - no intersection where only partial intersection',() => {

            expect(intersect([[1,2],[2,3],[3,4]])).toEqual([]);
        });


        it('subtract', () => {

            expect(subtract([1,2,3],[3,4,5])).toEqual([1,2]);
        });


        it('subtract: from empty list', () => {

            expect(subtract([],[3,4,5])).toEqual([]);
        });


        it('subtract: empty list', () => {

            expect(subtract([1,2,3],[])).toEqual([1,2,3]);
        });


        it('subtract: no intersection', () => {

            expect(subtract([1,2,3],[4,5,6])).toEqual([1,2,3]);
        });


        it('subtractTwo',() => {

            expect(subtractTwo([[1,2],[2,2]],[1,2,3,4])).toEqual([3,4]);
        });


        it('take five', () =>

            expect(takeWhile(smaller(20))
                ([7, 9, 10, 13, 17, 20])).toEqual([7, 9, 10, 13, 17])
        );


        it('take none', () =>

            expect(takeWhile(bigger(23))
                ([7, 9, 10, 13, 17, 20])).toEqual([])
        );


        it('take all', () =>

            expect(takeWhile(bigger(1))
                ([7, 9])).toEqual([7, 9])
        );


        it('empty', () =>

            expect(takeWhile(bigger(23))
                ([])).toEqual([])
        );


        it('until: take two', () => {

            expect(takeUntil(bigger(7))
                ([7, 9, 11])).toEqual([7, 9]);
        });


        it('until: take all', () =>

            expect(takeUntil(bigger(13))
                ([7, 9, 11])).toEqual([7, 9, 11])
        );


        it('until: empty', () =>

            expect(takeUntil(bigger(13))
                ([])).toEqual([])
        );


        it('removeFrom', () =>

            expect(removeFrom([1,2,13,13,4])(13)).toEqual([1,2,4])
        );


        it('removeFrom: nothing', () =>

            expect(removeFrom([1,2,7,4])(13)).toEqual([1,2,7,4])
        );


        it('removeFrom: everything', () =>

            expect(removeFrom([1,1])(1)).toEqual([])
        );


        it('times', () =>

            expect(times(2)
                (2)).toEqual(4)
        );


        it('map', () =>

            expect(map(times(2))
                ([2,4])).toEqual(([4,8]))
        );


        it('filter', () =>

            expect(filter(smaller(4))
                ([2,4,1,5,7,8,2,1,0])).toEqual(([2,1,2,1,0]))
        );


        it('flow', () =>

            expect(flow(
                    takeWhile(bigger(4)),
                    map(times(2)),
                    filter(smaller(16)),
{'fraction_non_alphanumeric': 0.2301573577727823, 'fraction_numerical': 0.0525678713470517, 'mean_word_length': 1.6753006475485661, 'pattern_counts': {'":': 0, '<': 5, '<?xml version=': 0, '>': 47, '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': '3380954', 'n_tokens_mistral': 2084, 'n_tokens_neox': 1854, 'n_words': 248}