<commit_before>//
//  TryTests.swift
//  TryTests
//
//  Created by <NAME> on 6/11/15.
//  Copyright © 2015 <NAME>. All rights reserved.
//

import XCTest

class TryTests: XCTestCase {
    
    override func setUp() {
        super.setUp()
        // Put setup code here. This method is called before the invocation of each test method in the class.
    }
    
    override func tearDown() {
        // Put teardown code here. This method is called after the invocation of each test method in the class.
        super.tearDown()
    }
    
    func testExample() {
        // This is an example of a functional test case.
        // Use XCTAssert and related functions to verify your tests produce the correct results.
    }
    
    func testPerformanceExample() {
        // This is an example of a performance test case.
        self.measureBlock() {
            // Put the code you want to measure the time of here.
        }
    }
    
}<commit_msg>add test code<commit_after>//
//  TryTests.swift
//  TryTests
//
//  Created by <NAME> on 6/11/15.
//  Copyright © 2015 <NAME>. All rights reserved.
//

import XCTest
import Try

enum TestError: ErrorType {
    case InvalidString(String)
    case Unknown
}

func stringToInt(s: String) throws -> Int {
    if let i = Int(s) {
        return i
    } else {
        throw TestError.InvalidString(s)
    }
}


final class TryTests: XCTestCase {
    
    override func setUp() {
        super.setUp()
    }
    
    override func tearDown() {
        super.tearDown()
    }
    
    func testSuccessTry() {
        let t = Try(try stringToInt("1"))
        switch t {
            case .Success(let value): print(value) //XCTAssertEqual(value, 1, "Try should return 1")
            case .Failure: XCTAssertFalse(true, "Try should not be failed")
        }
    }
    
    func testFailureTry() {
        let e = TestError.InvalidString("not number")
        let t = Try<Int>(error: e)
        
        switch t {
            case .Success: XCTAssertFalse(true, "Try should not be succeeded")
            case .Failure(let error): print(error) //XCTAssertEqual(error, e, "Try should return an error")
        }
    }
}
{'fraction_non_alphanumeric': 0.10069284064665127, 'fraction_numerical': 0.009699769053117783, 'mean_word_length': 1.9793672627235213, 'pattern_counts': {'":': 0, '<': 8, '<?xml version=': 0, '>': 9, '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': '5359438', 'n_tokens_mistral': 660, 'n_tokens_neox': 635, 'n_words': 222}