<commit_before>describe("DateCalc", function() {
    it("can calculate the period between the start and the end dates.",
        function() {
            expect(DateCalc.calculate("0001-01-01", "0001-01-02"))
                .toBe("1 day");
            expect(DateCalc.calculate("2000-01-01", "2001-03-02"))
                .toBe("426 days (1 year 2 months 1 day)");
            expect(DateCalc.calculate("today", "Today"))
                .toBe("0 days");
        }
    );
})

describe("LocalDate", function() {
    it("can parse a string to get a LocalDate object.", function() {
        expect(LocalDate.parse("2017-01-02").toString()).toBe("2017-01-02");
        expect(LocalDate.parse("01/02/2017").toString()).toBe("2017-01-02");
        expect(LocalDate.parse("Jan 2 2017").toString()).toBe("2017-01-02");
        expect(LocalDate.parse("January 2 2017").toString()).toBe("2017-01-02");
        expect(LocalDate.parse("today") instanceof LocalDate).toBe(true);
    });
    it("can calculate days until another date.", function() {
        expect(LocalDate.parse("1-1-1").daysUntil(LocalDate.parse("1-1-2")))
            .toBe(1);
        expect(LocalDate.parse("1-1-1").daysUntil(LocalDate.parse("1-2-2")))
            .toBe(32);
        expect(LocalDate.parse("1-1-1").daysUntil(LocalDate.parse("4-3-3")))
            .toBe(1157);
    });
    it("can calculate days since hypothetical Day 0.", function() {
        expect(LocalDate.parse("1-1-1").sinceDayZero()).toBe(1);
        expect(LocalDate.parse("1-2-2").sinceDayZero()).toBe(33);
        expect(LocalDate.parse("4-3-3").sinceDayZero()).toBe(1158);
    });
})

describe("Period", function() {
    it("can calculate the days between the start and the end dates.",
        function() {
            expect(new Period(new LocalDate(1, 1, 1),
                new LocalDate(1, 1, 2)).getDays()).toBe(1);
            expect(new Period(new LocalDate(1, 1, 1),
                new LocalDate(1, 3, 1)).getDays()).toBe(59);
            expect(new Period(new LocalDate(2000, 1, 1),
                new LocalDate(2001, 1, 1)).getDays()).toBe(366);<commit_msg>Add trivial unit tests for LocalDate.<commit_after>describe("DateCalc", function() {
    it("can calculate the period between the start and the end dates.",
        function() {
            expect(DateCalc.calculate("0001-01-01", "0001-01-02"))
                .toBe("1 day");
            expect(DateCalc.calculate("2000-01-01", "2001-03-02"))
                .toBe("426 days (1 year 2 months 1 day)");
            expect(DateCalc.calculate("today", "Today"))
                .toBe("0 days");
        }
    );
})

describe("LocalDate", function() {
    it("can parse a string to get a LocalDate object.", function() {
        expect(LocalDate.parse("2017-01-02").toString()).toBe("2017-01-02");
        expect(LocalDate.parse("01/02/2017").toString()).toBe("2017-01-02");
        expect(LocalDate.parse("Jan 2 2017").toString()).toBe("2017-01-02");
        expect(LocalDate.parse("January 2 2017").toString()).toBe("2017-01-02");
        expect(LocalDate.parse("today") instanceof LocalDate).toBe(true);
    });
    it("can calculate days until another date.", function() {
        expect(LocalDate.parse("1-1-1").daysUntil(LocalDate.parse("1-1-2")))
            .toBe(1);
        expect(LocalDate.parse("1-1-1").daysUntil(LocalDate.parse("1-2-2")))
            .toBe(32);
        expect(LocalDate.parse("1-1-1").daysUntil(LocalDate.parse("4-3-3")))
            .toBe(1157);
    });
    it("can calculate days since hypothetical Day 0.", function() {
        expect(LocalDate.parse("1-1-1").sinceDayZero()).toBe(1);
        expect(LocalDate.parse("1-2-2").sinceDayZero()).toBe(33);
        expect(LocalDate.parse("4-3-3").sinceDayZero()).toBe(1158);
    });
    it("can print out string representation.", function() {
        expect(LocalDate.parse("2018-5-6").toString()).toBe("2018-05-06");
        expect(LocalDate.parse("03/04/2018").toString()).toBe("2018-03-04");
        expect(LocalDate.parse("Feb. 1 2018").toString()).toBe("2018-02-01");
    });
})

describe("Period", function() {
    it("can calculate the days between the start and the end dates.",
        function() {
            expect(new Period(new LocalDate(1, 1, 1),
                new LocalDate(1, 1, 2)).getDays()).toBe(1);
            expect(new Period(new LocalDate(1, 1, 1),
                new LocalDate(1, 3, 1)).getDays()).toBe(59);
            expect(new Period(new LocalDate(2000, 1, 1),
                new LocalDate(2001, 1, 1)).getDays()).toBe(366);
{'fraction_non_alphanumeric': 0.19256161971830985, 'fraction_numerical': 0.08428697183098592, 'mean_word_length': 2.698128559804719, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 3, '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': '859193', 'n_tokens_mistral': 1636, 'n_tokens_neox': 1386, 'n_words': 255}