<commit_before>//
//  RuleTests.swift
//  SwiftLint
//
//  Created by <NAME> on 12/29/15.
//  Copyright © 2015 Realm. All rights reserved.
//

import XCTest
import SourceKittenFramework
@testable import SwiftLintFramework

class RuleMock1: Rule {
    static let description = RuleDescription(identifier: "RuleMock1", name: "", description: "")
    func validateFile(file: File) -> [StyleViolation] {
        return []
    }
}

class RuleMock2: Rule {
    static let description = RuleDescription(identifier: "RuleMock2", name: "", description: "")
    func validateFile(file: File) -> [StyleViolation] {
        return []
    }
}

class RuleTests: XCTestCase {

    private class ParameterizedRuleMock1: RuleMock1, ParameterizedRule {
        let parameters: [RuleParameter<Int>]
        required init(parameters: [RuleParameter<Int>]) {
            self.parameters = parameters
        }
    }

    private class ParameterizedRuleMock2: RuleMock2, ParameterizedRule {
        let parameters: [RuleParameter<Int>]
        required init(parameters: [RuleParameter<Int>]) {
            self.parameters = parameters
        }
    }

    func testRuleIsEqualTo() {
        XCTAssertTrue(RuleMock1().isEqualTo(RuleMock1()))
    }

    func testRuleIsNotEqualTo() {
        XCTAssertFalse(RuleMock1().isEqualTo(RuleMock2()))
    }

    func testParameterizedRuleIsEqualTo() {
        let params = [RuleParameter(severity: .Warning, value: 20),
                      RuleParameter(severity: .Warning, value: 40)]
        XCTAssertTrue(ParameterizedRuleMock1(parameters: params)
           .isEqualTo(ParameterizedRuleMock1(parameters: params)))
    }

    func testParameterizedRuleIsNotEqualTo1() {
        let params1 = [RuleParameter(severity: .Warning, value: 20),
                       RuleParameter(severity: .Warning, value: 40)]
        let params2 = [RuleParameter(severity: .Warning, value: 40),
                       RuleParameter(severity: .Warning, value: 60)]
        XCTAssertFalse(ParameterizedRuleMock1(parameters: params1)
            .isEqualTo(ParameterizedRuleMock1(parameters: params2)))
    }

    func testParameterizedRuleIsNotEqualTo2() {
        let params1 = [RuleParameter(severity: .Warning, value: 20),
            RuleParameter(severity: .Warning, value: 40)]
        let params2 = [RuleParameter(severity: .Warning, value: 40),
            RuleParameter(severity: .Warning, value: 60)]
        XCTAssertFalse(ParameterizedRuleMock1(parameters: params1)
            .isEqualTo(ParameterizedRuleMock2(parameters: params2)))
    }

    func testParameterizedRuleIsNotEqualToRule() {
        let params = [RuleParameter(severity: .Warning, value: 20),
            RuleParameter(severity: .Warning, value: 40)]
        XCTAssertFalse(ParameterizedRuleMock1(parameters: params)
            .isEqualTo(RuleMock2()))
    }

    func testRuleArraysWithDifferentCountsNotEqual() {
        XCTAssertNotEqual([RuleMock1(), RuleMock2()], [RuleMock1()])
    }

}
<commit_msg>No longer needed RuleMocks at global scope.<commit_after>//
//  RuleTests.swift
//  SwiftLint
//
//  Created by <NAME> on 12/29/15.
//  Copyright © 2015 Realm. All rights reserved.
//

import XCTest
import SourceKittenFramework
@testable import SwiftLintFramework

class RuleTests: XCTestCase {

    private class RuleMock1: Rule {
        static let description = RuleDescription(identifier: "RuleMock1", name: "", description: "")
        func validateFile(file: File) -> [StyleViolation] {
            return []
        }
    }

    private class RuleMock2: Rule {
        static let description = RuleDescription(identifier: "RuleMock2", name: "", description: "")
        func validateFile(file: File) -> [StyleViolation] {
            return []
        }
    }

    private class ParameterizedRuleMock1: RuleMock1, ParameterizedRule {
        let parameters: [RuleParameter<Int>]
        required init(parameters: [RuleParameter<Int>]) {
            self.parameters = parameters
        }
    }

    private class ParameterizedRuleMock2: RuleMock2, ParameterizedRule {
        let parameters: [RuleParameter<Int>]
        required init(parameters: [RuleParameter<Int>]) {
            self.parameters = parameters
        }
    }

    func testRuleIsEqualTo() {
        XCTAssertTrue(RuleMock1().isEqualTo(RuleMock1()))
    }

    func testRuleIsNotEqualTo() {
        XCTAssertFalse(RuleMock1().isEqualTo(RuleMock2()))
    }

    func testParameterizedRuleIsEqualTo() {
        let params = [RuleParameter(severity: .Warning, value: 20),
                      RuleParameter(severity: .Warning, value: 40)]
        XCTAssertTrue(ParameterizedRuleMock1(parameters: params)
           .isEqualTo(ParameterizedRuleMock1(parameters: params)))
    }

    func testParameterizedRuleIsNotEqualTo1() {
        let params1 = [RuleParameter(severity: .Warning, value: 20),
                       RuleParameter(severity: .Warning, value: 40)]
        let params2 = [RuleParameter(severity: .Warning, value: 40),
                       RuleParameter(severity: .Warning, value: 60)]
        XCTAssertFalse(ParameterizedRuleMock1(parameters: params1)
            .isEqualTo(ParameterizedRuleMock1(parameters: params2)))
    }

    func testParameterizedRuleIsNotEqualTo2() {
        let params1 = [RuleParameter(severity: .Warning, value: 20),
            RuleParameter(severity: .Warning, value: 40)]
        let params2 = [RuleParameter(severity: .Warning, value: 40),
            RuleParameter(severity: .Warning, value: 60)]
        XCTAssertFalse(ParameterizedRuleMock1(parameters: params1)
            .isEqualTo(ParameterizedRuleMock2(parameters: params2)))
    }

    func testParameterizedRuleIsNotEqualToRule() {
        let params = [RuleParameter(severity: .Warning, value: 20),
            RuleParameter(severity: .Warning, value: 40)]
        XCTAssertFalse(ParameterizedRuleMock1(parameters: params)
            .isEqualTo(RuleMock2()))
    }

    func testRuleArraysWithDifferentCountsNotEqual() {
        XCTAssertNotEqual([RuleMock1(), RuleMock2()], [RuleMock1()])
    }

}

{'fraction_non_alphanumeric': 0.10721343873517787, 'fraction_numerical': 0.02206851119894598, 'mean_word_length': 3.0006587615283267, 'pattern_counts': {'":': 0, '<': 13, '<?xml version=': 0, '>': 17, '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': '4660825', 'n_tokens_mistral': 1777, 'n_tokens_neox': 1680, 'n_words': 358}