<commit_before>//
// Created by <NAME> on 16.04.17.
// Copyright (c) 2017 <NAME>. All rights reserved.
//

import Foundation
import XCTest
@testable import MammutAPI

internal class TimelinesTests: XCTestCase {
    func test_casesWithNoAssociatedValueEquality_equal() {
        var sutLhs: Endpoint.Timeline
        var sutRhs: Endpoint.Timeline

        sutLhs = .home
        sutRhs = .home
        XCTAssertEqual(sutLhs, sutRhs)

        sutLhs = .local
        sutRhs = .local
        XCTAssertEqual(sutLhs, sutRhs)
    }

    func test_casesWithNoAssociatedValueEquality_notEqual() {
        let sutLhs: Endpoint.Timeline = .local
        let sutRhs: Endpoint.Timeline = .home
        XCTAssertNotEqual(sutLhs, sutRhs)
    }

    func test_tagWithSameTextEquality_equal() {
        let sutLhs = Endpoint.Timeline.tag("test")
        let sutRhs = Endpoint.Timeline.tag("test")
        XCTAssertEqual(sutLhs, sutRhs)
    }

    func test_tagWithDifferentTextEquality_notEqual() {
        let sutLhs = Endpoint.Timeline.tag("test")
        let sutRhs = Endpoint.Timeline.tag("anotherTag")
        XCTAssertNotEqual(sutLhs, sutRhs)
    }

    func test_tagNoAssociatedTypeWithAssociatedTypeEquality_notEqual() {
        XCTAssertNotEqual(Endpoint.Timeline.local, Endpoint.Timeline.tag("tag"))
        XCTAssertNotEqual(Endpoint.Timeline.home, Endpoint.Timeline.tag("tag"))
    }

    func test_path_isNotNil() {
        XCTAssertNotNil(Endpoint.Timeline.local.path)
        XCTAssertNotNil(Endpoint.Timeline.home.path)
        XCTAssertNotNil(Endpoint.Timeline.tag("tag").path)
    }

    func test_path_containsTimelinesAsBase() {
        XCTAssertTrue(Endpoint.Timeline.local.path!.hasPrefix(Endpoint.Timeline.timelinePath))
        XCTAssertTrue(Endpoint.Timeline.home.path!.hasPrefix(Endpoint.Timeline.timelinePath))
        XCTAssertTrue(Endpoint.Timeline.tag("tag").path!.hasPrefix(Endpoint.Timeline.timelinePath))
    }
}

// MARK: - Linux Support

extension TimelinesTests {
    static var allTests: [(String, (TimelinesTests) -> () throws -> Void)] {
        return [
                ("test_casesWithNoAssociatedValueEquality_equal", test_casesWithNoAssociatedValueEquality_equal),
                ("test_casesWithNoAssociatedValueEquality_notEqual", test_casesWithNoAssociatedValueEquality_notEqual),
                ("test_tagWithSameTextEquality_equal", test_tagWithSameTextEquality_equal),
                ("test_tagWithDifferentTextEquality_notEqual", test_tagWithDifferentTextEquality_notEqual),
                ("test_tagNoAssociatedTypeWithAssociatedTypeEquality_notEqual", test_tagNoAssociatedTypeWithAssociatedTypeEquality_notEqual),
                ("test_path_isNotNil", test_path_isNotNil),
                ("test_path_containsTimelinesAsBase", test_path_containsTimelinesAsBase)
        ]
    }
}<commit_msg>✅ Added missing tests to Timelines endpoint<commit_after>//
// Created by <NAME> on 16.04.17.
// Copyright (c) 2017 <NAME>. All rights reserved.
//

import Foundation
import XCTest
@testable import MammutAPI

internal class TimelinesTests: XCTestCase {
    func test_casesWithNoAssociatedValueEquality_equal() {
        var sutLhs: Endpoint.Timeline
        var sutRhs: Endpoint.Timeline

        sutLhs = .home
        sutRhs = .home
        XCTAssertEqual(sutLhs, sutRhs)

        sutLhs = .local
        sutRhs = .local
        XCTAssertEqual(sutLhs, sutRhs)
    }

    func test_casesWithNoAssociatedValueEquality_notEqual() {
        let sutLhs: Endpoint.Timeline = .local
        let sutRhs: Endpoint.Timeline = .home
        XCTAssertNotEqual(sutLhs, sutRhs)
    }

    func test_tagWithSameTextEquality_equal() {
        let sutLhs = Endpoint.Timeline.tag("test")
        let sutRhs = Endpoint.Timeline.tag("test")
        XCTAssertEqual(sutLhs, sutRhs)
    }

    func test_tagWithDifferentTextEquality_notEqual() {
        let sutLhs = Endpoint.Timeline.tag("test")
        let sutRhs = Endpoint.Timeline.tag("anotherTag")
        XCTAssertNotEqual(sutLhs, sutRhs)
    }

    func test_tagNoAssociatedTypeWithAssociatedTypeEquality_notEqual() {
        XCTAssertNotEqual(Endpoint.Timeline.local, Endpoint.Timeline.tag("tag"))
        XCTAssertNotEqual(Endpoint.Timeline.home, Endpoint.Timeline.tag("tag"))
    }

    func test_path_isNotNil() {
        XCTAssertNotNil(Endpoint.Timeline.local.path)
        XCTAssertNotNil(Endpoint.Timeline.home.path)
        XCTAssertNotNil(Endpoint.Timeline.tag("tag").path)
    }

    func test_path_containsTimelinesAsBase() {
        XCTAssertTrue(Endpoint.Timeline.local.path!.hasPrefix(Endpoint.Timeline.timelinePath))
        XCTAssertTrue(Endpoint.Timeline.home.path!.hasPrefix(Endpoint.Timeline.timelinePath))
        XCTAssertTrue(Endpoint.Timeline.tag("tag").path!.hasPrefix(Endpoint.Timeline.timelinePath))
    }

    func test_method_inAllCases_isGet() {
        XCTAssertEqual(Method.get, Endpoint.Timeline.local.method)
        XCTAssertEqual(Method.get, Endpoint.Timeline.home.method)
        XCTAssertEqual(Method.get, Endpoint.Timeline.tag("tag").method)
    }

    func test_validResponseCodes_inAllCases_isRangeBetween200_300() {
        XCTAssertEqual(200..<300, Endpoint.Timeline.local.validResponseCodes)
        XCTAssertEqual(200..<300, Endpoint.Timeline.home.validResponseCodes)
        XCTAssertEqual(200..<300, Endpoint.Timeline.tag("tag").validResponseCodes)
    }
}

// MARK: - Linux Support

extension TimelinesTests {
    static var allTests: [(String, (TimelinesTests) -> () throws -> Void)] {
        return [
                ("test_casesWithNoAssociatedValueEquality_equal", test_casesWithNoAssociatedValueEquality_equal),
                ("test_casesWithNoAssociatedValueEquality_notEqual", test_casesWithNoAssociatedValueEquality_notEqual),
                ("test_tagWithSameTextEquality_equal", test_tagWithSameTextEquality_equal),
                ("test_tagWithDifferentTextEquality_notEqual", test_tagWithDifferentTextEquality_notEqual),
                ("test_tagNoAssociatedTypeWithAssociatedTypeEquality_notEqual", test_tagNoAssociatedTypeWithAssociatedTypeEquality_notEqual),
                ("test_path_isNotNil", test_path_isNotNil),
                ("test_path_containsTimelinesAsBase", test_path_containsTimelinesAsBase),
                ("test_method_inAllCases_isGet", test_method_inAllCases_isGet),
                ("test_validResponseCodes_inAllCases_isRangeBetween200_300", test_validResponseCodes_inAllCases_isRangeBetween200_300)
        ]
    }
}
{'fraction_non_alphanumeric': 0.09214384935946905, 'fraction_numerical': 0.008643309152647013, 'mean_word_length': 3.5569620253164556, 'pattern_counts': {'":': 0, '<': 10, '<?xml version=': 0, '>': 11, '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': '12582', 'n_tokens_mistral': 2131, 'n_tokens_neox': 2015, 'n_words': 264}