<commit_before>//
//  TimePeriodGroupTests.swift
//  DateToolsTests
//
//  Created by <NAME> on 8/19/16.
//  Copyright © 2016 <NAME>. All rights reserved.
//

import XCTest
@testable import DateToolsTests


class TimePeriodGroupTests : XCTestCase {
    
    var formatter = DateFormatter()
    var controlCollection = TimePeriodCollection()
    
    override func setUp() {
        //Initialize control TimePeriodChain
        self.controlCollection = TimePeriodCollection()
        //Initialize formatter
        self.formatter = DateFormatter()
        self.formatter.dateFormat = "yyyy MM dd HH:mm:ss.SSS"
        //Create test TimePeriods that are 1 year long
        var firstPeriod = TimePeriod(startDate: self.formatter.dateFromString("2014 11 05 18:15:12.000"), endDate: self.formatter.dateFromString("2015 11 05 18:15:12.000"))
        var secondPeriod = TimePeriod(startDate: self.formatter.dateFromString("2015 11 05 18:15:12.000"), endDate: self.formatter.dateFromString("2016 11 05 18:15:12.000"))
        var thirdPeriod = TimePeriod(startDate: self.formatter.dateFromString("2016 11 05 18:15:12.000"), endDate: self.formatter.dateFromString("2017 11 05 18:15:12.000"))
        var fourthPeriod = TimePeriod(startDate: self.formatter.dateFromString("2015 4 05 18:15:12.000"), endDate: self.formatter.dateFromString("2017 4 05 18:15:12.000"))
        //Add test periods
        self.controlCollection.addTimePeriod(firstPeriod)
        self.controlCollection.addTimePeriod(secondPeriod)
        self.controlCollection.addTimePeriod(thirdPeriod)
        self.controlCollection.addTimePeriod(fourthPeriod)
    }
    
    override func tearDown() {
        // Put teardown code here. This method is called after the invocation of each test method in the class.
        super.tearDown()
    }
    
    // MARK: - Group Info
    func testDurationInYears() {
        XCTAssertEqual(3, self.controlCollection.durationInYears)
    }
    
    func testDurationInWeeks() {
        XCTAssertEqual(156, self.controlCollection.durationInWeeks)
    }
    
    func testDurationInDays() {
        XCTAssertEqual(1096, self.controlCollection.durationInDays)
    }
    
    func testDurationInHours() {
        XCTAssertEqual(26304, self.controlCollection.durationInHours)
    }
    
    func testDurationInMinutes() {
        XCTAssertEqual(1578240, self.controlCollection.durationInMinutes)
    }
    
    func testDurationInSeconds() {
        XCTAssertEqual(94694400, self.controlCollection.durationInSeconds)
    }
    
    // MARK: - Comparison
    func testHasSameCharacteristicsAs() {
        var collectionSame: TimePeriodCollection = TimePeriodCollection()
        var chain: TimePeriodChain = TimePeriodChain()
        //Create test TimePeriods to construct same as control
        //Add test periods
        collectionSame.addTimePeriod(firstPeriod)
        collectionSame.addTimePeriod(secondPeriod)
        collectionSame.addTimePeriod(thirdPeriod)
        collectionSame.addTimePeriod(fourthPeriod)
        chain.addTimePeriod(firstPeriod)
        chain.addTimePeriod(secondPeriod)
        chain.addTimePeriod(thirdPeriod)
        chain.addTimePeriod(fourthPeriod)
        //Test same as control
        XCTAssertTrue(self.controlCollection.hasSameCharacteristicsAs(collectionSame))
        //Test differnt chain
        XCTAssertFalse(self.controlCollection.hasSameCharacteristicsAs(chain))
        //Test alternate
        collectionSame.removeTimePeriodAtIndex(3)
        collectionSame.addTimePeriod(alternateFourthPeriod)
        XCTAssertTrue(self.controlCollection.hasSameCharacteristicsAs(collectionSame))
    }
    
}
<commit_msg>- Fixed errors in TimePeriodGroupTests<commit_after>//
//  TimePeriodGroupTests.swift
//  DateToolsTests
//
//  Created by <NAME> on 8/19/16.
//  Copyright © 2016 <NAME>. All rights reserved.
//

import XCTest
@testable import DateToolsTests


class TimePeriodGroupTests : XCTestCase {
    
    var formatter = DateFormatter()
    var controlCollection = TimePeriodCollection()
    var firstPeriod = TimePeriod()
    var secondPeriod = TimePeriod()
    var thirdPeriod = TimePeriod()
    var fourthPeriod = TimePeriod()
    
    override func setUp() {
        //Initialize control TimePeriodChain
        self.controlCollection = TimePeriodCollection()
        //Initialize formatter
        self.formatter.dateFormat = "yyyy MM dd HH:mm:ss.SSS"
        //Create test TimePeriods that are 1 year long
        firstPeriod = TimePeriod(beginning: self.formatter.date(from: "2014 11 05 18:15:12.000")!, end: self.formatter.date(from: "2015 11 05 18:15:12.000")!)
        secondPeriod = TimePeriod(beginning: self.formatter.date(from: "2015 11 05 18:15:12.000")!, end: self.formatter.date(from: "2016 11 05 18:15:12.000")!)
        thirdPeriod = TimePeriod(beginning: self.formatter.date(from: "2016 11 05 18:15:12.000")!, end: self.formatter.date(from: "2017 11 05 18:15:12.000")!)
        fourthPeriod = TimePeriod(beginning: self.formatter.date(from: "2015 4 05 18:15:12.000")!, end: self.formatter.date(from: "2017 4 05 18:15:12.000")!)
        //Add test periods
        self.controlCollection.add(firstPeriod)
        self.controlCollection.add(secondPeriod)
        self.controlCollection.add(thirdPeriod)
        self.controlCollection.add(fourthPeriod)
    }
    
    override func tearDown() {
        // Put teardown code here. This method is called after the invocation of each test method in the class.
        super.tearDown()
    }
    
    // MARK: - Group Info
    func testDurationInWeeks() {
        XCTAssertEqual(156, self.controlCollection.durationInWeeks)
    }
    
    func testDurationInDays() {
        XCTAssertEqual(1096, self.controlCollection.durationInDays)
    }
    
    func testDurationInHours() {
        XCTAssertEqual(26304, self.controlCollection.durationInHours)
    }
    
    func testDurationInMinutes() {
        XCTAssertEqual(1578240, self.controlCollection.durationInMinutes)
    }
    
    func testDurationInSeconds() {
        XCTAssertEqual(94694400, self.controlCollection.durationInSeconds)
    }
    
    // MARK: - Comparison
    func testHasSameCharacteristicsAs() {
        var collectionSame: TimePeriodCollection = TimePeriodCollection()
        var chain: TimePeriodChain = TimePeriodChain()
        //Create test TimePeriods to construct same as control
        //Add test periods
        collectionSame.add(firstPeriod)
        collectionSame.add(secondPeriod)
        collectionSame.add(thirdPeriod)
        collectionSame.add(fourthPeriod)
        chain.add(firstPeriod)
        chain.add(secondPeriod)
        chain.add(thirdPeriod)
        chain.add(fourthPeriod)
        //Test same as control
        XCTAssertTrue(self.controlCollection.hasSameCharacteristicsAs(collectionSame))
        //Test differnt chain
        XCTAssertFalse(self.controlCollection.hasSameCharacteristicsAs(chain))
        //Test alternate
        collectionSame.removeTimePeriodAtIndex(3)
        collectionSame.addTimePeriod(alternateFourthPeriod)
        XCTAssertTrue(self.controlCollection.hasSameCharacteristicsAs(collectionSame))
    }
    
}

{'fraction_non_alphanumeric': 0.09215686274509804, 'fraction_numerical': 0.04831932773109244, 'mean_word_length': 3.178466939730837, 'pattern_counts': {'":': 0, '<': 7, '<?xml version=': 0, '>': 7, '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': '1694215', 'n_tokens_mistral': 2283, 'n_tokens_neox': 1959, 'n_words': 420}