<commit_before>//
//  JSONModelErrorTests.swift
//  SwiftyJSONModel
//
//  Created by Oleksii on 28/09/2016.
//  Copyright © 2016 <NAME>. All rights reserved.
//

import XCTest
import SwiftyJSONModel

class JSONModelErrorTests: XCTestCase {
    
    func testErrorEquatable() {
        XCTAssertEqual(JSONModelError.invalidElement, .invalidElement)
        XCTAssertEqual(JSONModelError.jsonIsNotAnObject, .jsonIsNotAnObject)
        XCTAssertEqual(JSONModelError.invalidValueFor(key: "test", .invalidElement), .invalidValueFor(key: "test", .invalidElement))
        
        XCTAssertNotEqual(JSONModelError.invalidValueFor(key: "test", .invalidElement), .invalidValueFor(key: "other", .invalidElement))
        XCTAssertNotEqual(JSONModelError.invalidValueFor(key: "test", .invalidElement), .invalidElement)
        
    }
    
}<commit_msg>Cover error’s string description with tests<commit_after>//
//  JSONModelErrorTests.swift
//  SwiftyJSONModel
//
//  Created by Oleksii on 28/09/2016.
//  Copyright © 2016 <NAME>. All rights reserved.
//

import XCTest
import SwiftyJSONModel

class JSONModelErrorTests: XCTestCase {
    
    func testErrorEquatable() {
        XCTAssertEqual(JSONModelError.invalidElement, .invalidElement)
        XCTAssertEqual(JSONModelError.jsonIsNotAnObject, .jsonIsNotAnObject)
        XCTAssertEqual(JSONModelError.invalidValueFor(key: "test", .invalidElement), .invalidValueFor(key: "test", .invalidElement))
        
        XCTAssertNotEqual(JSONModelError.invalidValueFor(key: "test", .invalidElement), .invalidValueFor(key: "other", .invalidElement))
        XCTAssertNotEqual(JSONModelError.invalidValueFor(key: "test", .invalidElement), .invalidElement)
        
    }
    
    func testErrorStringDescription() {
        let desiredDescription = "[country][city][name]: Invalid element"
        let error = JSONModelError.invalidValueFor(key: "country", .invalidValueFor(key: "city", .invalidValueFor(key: "name", .invalidElement)))
        XCTAssertEqual(error.description, desiredDescription)
        
        let objectErrorString = "[country]: \(JSONModelError.jsonIsNotAnObject.description)"
        XCTAssertEqual(JSONModelError.invalidValueFor(key: "country", .jsonIsNotAnObject).description, objectErrorString)
    }
}
{'fraction_non_alphanumeric': 0.11067019400352733, 'fraction_numerical': 0.010582010582010581, 'mean_word_length': 4.098876404494382, 'pattern_counts': {'":': 0, '<': 5, '<?xml version=': 0, '>': 5, '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': '3739996', 'n_tokens_mistral': 683, 'n_tokens_neox': 656, 'n_words': 119}