<commit_before>//
//  UInt+AtlasMapTests.swift
//  Atlas
//
//  Created by <NAME> on 8/5/16.
//  Copyright © 2016 RentPath. All rights reserved.
//

import XCTest
@testable import Atlas

class UInt_AtlasMapTests: XCTestCase {

    var json: JSON!

    override func setUp() {
        super.setUp()
        let i: UInt = 702888806
        let i8: UInt8 = 70
        let i16: UInt16 = 7028
        let i32: UInt32 = 702888806
        let i64: UInt64 = 70288880664460
        let dict: [String: Any] = [
            "ui": NSNumber(value: i as UInt),
            "ui8": NSNumber(value: i8 as UInt8),
            "ui16": NSNumber(value: i16 as UInt16),
            "ui32": NSNumber(value: i32 as UInt32),
            "ui64": NSNumber(value: i64 as UInt64)
        ]
        let data = try! JSONSerialization.data(withJSONObject: dict, options: JSONSerialization.WritingOptions(rawValue: 0))
        json = try! JSONSerialization.jsonObject(with: data, options: JSONSerialization.ReadingOptions(rawValue: 0)) as JSON!
    }

    override func tearDown() {
        json = nil
        super.tearDown()
    }

    func testUIntMappingMapsIntegerValuesWithinManAndMaxRange() {
        let min = UInt.min
        let max = UInt.max

        XCTAssertEqual(UInt(min), UInt.min)
        XCTAssertEqual(UInt(max), UInt.max)
    }

    func testIntMappingPerformance() {
        self.measure {
            for _ in 0..<100_000 {
                let _ = UInt(702888806)
            }
        }
    }

    func testUIntMappingThrowsErrorIfUnableToMap() {
        XCTAssertThrowsError(try UInt(json: (json as AnyObject)["ui"]))
    }

    func testUInt64MappingThrowsErrorIfUnableToMap() {
        XCTAssertThrowsError(try UInt64(json: (json as AnyObject)["ui64"]))
    }<commit_msg>[#642284635] update swiftlint errors<commit_after>//
//  UInt+AtlasMapTests.swift
//  Atlas
//
//  Created by <NAME> on 8/5/16.
//  Copyright © 2016 RentPath. All rights reserved.
//

import XCTest
@testable import Atlas

class UInt_AtlasMapTests: XCTestCase {

    var json: JSON!

    override func setUp() {
        super.setUp()
        let i: UInt = 702888806
        let i8: UInt8 = 70
        let i16: UInt16 = 7028
        let i32: UInt32 = 702888806
        let i64: UInt64 = 70288880664460
        let dict: [String: Any] = [
            "ui": NSNumber(value: i as UInt),
            "ui8": NSNumber(value: i8 as UInt8),
            "ui16": NSNumber(value: i16 as UInt16),
            "ui32": NSNumber(value: i32 as UInt32),
            "ui64": NSNumber(value: i64 as UInt64)
        ]
        let data = try! JSONSerialization.data(withJSONObject: dict, options: JSONSerialization.WritingOptions(rawValue: 0))
        json = try! JSONSerialization.jsonObject(with: data, options: JSONSerialization.ReadingOptions(rawValue: 0)) as JSON!
    }

    override func tearDown() {
        json = nil
        super.tearDown()
    }

    func testUIntMappingMapsIntegerValuesWithinManAndMaxRange() {
        let min = UInt.min
        let max = UInt.max

        XCTAssertEqual(UInt(min), UInt.min)
        XCTAssertEqual(UInt(max), UInt.max)
    }
    func testIntMappingPerformance() {
        self.measure {
            for _ in 0..<100_000 {
                let _ = UInt(702888806)
            }
        }
    }

    func testUIntMappingThrowsErrorIfUnableToMap() {
        XCTAssertThrowsError(try UInt(json: (json as AnyObject)["ui"]))
    }

    func testUInt64MappingThrowsErrorIfUnableToMap() {
        XCTAssertThrowsError(try UInt64(json: (json as AnyObject)["ui64"]))
    }
{'fraction_non_alphanumeric': 0.10670045045045046, 'fraction_numerical': 0.06165540540540541, 'mean_word_length': 2.323666978484565, 'pattern_counts': {'":': 10, '<': 7, '<?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': '910681', 'n_tokens_mistral': 1317, 'n_tokens_neox': 1160, 'n_words': 275}