<commit_before>//
//  GobanViewTests.swift
//  GobanSampleProject
//
//  Created by Bobo on 3/20/16.
//  Copyright © 2016 <NAME>. All rights reserved.
//

import XCTest
@testable import GobanSampleProject

class GobanViewTests: XCTestCase {
    
    override func setUp() {
        super.setUp()
    }
    
    override func tearDown() {
        super.tearDown()
    }
    
    func testClosestGobanPointFromPoint() {
        var goban = GobanView(size: GobanSize(width: 19, height: 19), frame: CGRectMake(0.0, 0.0, 200.0, 200.0))

        var gobanPoint = goban.closestGobanPointFromPoint(CGPointZero)
        var expectedGobanPoint = GobanPoint(x: 1, y: 1)
        XCTAssertEqual(gobanPoint.x, expectedGobanPoint.x)
        XCTAssertEqual(gobanPoint.y, expectedGobanPoint.y)
        
        gobanPoint = goban.closestGobanPointFromPoint(CGPointMake(50.0, 50.0))
        expectedGobanPoint = GobanPoint(x: 6, y: 6)
        XCTAssertEqual(gobanPoint.x, expectedGobanPoint.x)
        XCTAssertEqual(gobanPoint.y, expectedGobanPoint.y)
        
        gobanPoint = goban.closestGobanPointFromPoint(CGPointMake(100.0, 100.0))
        expectedGobanPoint = GobanPoint(x: 10, y: 10)
        XCTAssertEqual(gobanPoint.x, expectedGobanPoint.x)
        XCTAssertEqual(gobanPoint.y, expectedGobanPoint.y)
        
        gobanPoint = goban.closestGobanPointFromPoint(CGPointMake(200.0, 200.0))
        expectedGobanPoint = GobanPoint(x: 19, y: 19)
        XCTAssertEqual(gobanPoint.x, expectedGobanPoint.x)
        XCTAssertEqual(gobanPoint.y, expectedGobanPoint.y)
        
        gobanPoint = goban.closestGobanPointFromPoint(CGPointMake(120.0, 40.0))
        expectedGobanPoint = GobanPoint(x: 12, y: 5)
        XCTAssertEqual(gobanPoint.x, expectedGobanPoint.x)
        XCTAssertEqual(gobanPoint.y, expectedGobanPoint.y)
        
        gobanPoint = goban.closestGobanPointFromPoint(CGPointMake(300.0, 300.0))
        expectedGobanPoint = GobanPoint(x: 19, y: 19)
        XCTAssertEqual(gobanPoint.x, expectedGobanPoint.x)
        XCTAssertEqual(gobanPoint.y, expectedGobanPoint.y)
        
        gobanPoint = goban.closestGobanPointFromPoint(CGPointMake(-1.0, -1.0))
        expectedGobanPoint = GobanPoint(x: 1, y: 1)
        XCTAssertEqual(gobanPoint.x, expectedGobanPoint.x)
        XCTAssertEqual(gobanPoint.y, expectedGobanPoint.y)
        
        gobanPoint = goban.closestGobanPointFromPoint(CGPointMake(-100.0, -100.0))
        expectedGobanPoint = GobanPoint(x: 1, y: 1)
        XCTAssertEqual(gobanPoint.x, expectedGobanPoint.x)
        XCTAssertEqual(gobanPoint.y, expectedGobanPoint.y)
        
        gobanPoint = goban.closestGobanPointFromPoint(CGPointMake(-100.0, 500.0))
        expectedGobanPoint = GobanPoint(x: 1, y: 19)
        XCTAssertEqual(gobanPoint.x, expectedGobanPoint.x)
        XCTAssertEqual(gobanPoint.y, expectedGobanPoint.y)
        
        goban = GobanView(size: GobanSize(width: 50, height: 20), frame: CGRectMake(0.0, 0.0, 100.0, 200.0))
        
        gobanPoint = goban.closestGobanPointFromPoint(CGPointZero)
        expectedGobanPoint = GobanPoint(x: 1, y: 1)
        XCTAssertEqual(gobanPoint.x, expectedGobanPoint.x)
        XCTAssertEqual(gobanPoint.y, expectedGobanPoint.y)
        
        gobanPoint = goban.closestGobanPointFromPoint(CGPointMake(50.0, 50.0))
        expectedGobanPoint = GobanPoint(x: 26, y: 6)
        XCTAssertEqual(gobanPoint.x, expectedGobanPoint.x)
        XCTAssertEqual(gobanPoint.y, expectedGobanPoint.y)
        
        gobanPoint = goban.closestGobanPointFromPoint(CGPointMake(100.0, 100.0))
        expectedGobanPoint = GobanPoint(x: 50, y: 11)
        XCTAssertEqual(gobanPoint.x, expectedGobanPoint.x)
        XCTAssertEqual(gobanPoint.y, expectedGobanPoint.y)
        
        gobanPoint = goban.closestGobanPointFromPoint(CGPointMake(200.0, 200.0))
        expectedGobanPoint = GobanPoint(x: 50, y: 20)
        XCTAssertEqual(gobanPoint.x, expectedGobanPoint.x)
        XCTAssertEqual(gobanPoint.y, expectedGobanPoint.y)
        
        gobanPoint = goban.closestGobanPointFromPoint(CGPointMake(120.0, 40.0))
        expectedGobanPoint = GobanPoint(x: 50, y: 5)
        XCTAssertEqual(gobanPoint.x, expectedGobanPoint.x)
        XCTAssertEqual(gobanPoint.y, expectedGobanPoint.y)
        
        gobanPoint = goban.closestGobanPointFromPoint(CGPointMake(300.0, 300.0))
        expectedGobanPoint = GobanPoint(x: 50, y: 20)
        XCTAssertEqual(gobanPoint.x, expectedGobanPoint.x)
        XCTAssertEqual(gobanPoint.y, expectedGobanPoint.y)
        
        gobanPoint = goban.closestGobanPointFromPoint(CGPointMake(-1.0, -1.0))
        expectedGobanPoint = GobanPoint(x: 1, y: 1)
        XCTAssertEqual(gobanPoint.x, expectedGobanPoint.x)
        XCTAssertEqual(gobanPoint.y, expectedGobanPoint.y)
        
        gobanPoint = goban.closestGobanPointFromPoint(CGPointMake(-100.0, -100.0))<commit_msg>Fix tests including padding.<commit_after>//
//  GobanViewTests.swift
//  GobanSampleProject
//
//  Created by Bobo on 3/20/16.
//  Copyright © 2016 <NAME>. All rights reserved.
//

import XCTest
@testable import GobanSampleProject

class GobanViewTests: XCTestCase {
    
    override func setUp() {
        super.setUp()
    }
    
    override func tearDown() {
        super.tearDown()
    }
    
    func testClosestGobanPointFromPoint() {
        var goban = GobanView(size: GobanSize(width: 19, height: 19), frame: CGRectMake(0.0, 0.0, 200.0, 200.0))

        var gobanPoint = goban.closestGobanPointFromPoint(CGPointZero)
        var expectedGobanPoint = GobanPoint(x: 1, y: 1)
        XCTAssertEqual(gobanPoint.x, expectedGobanPoint.x)
        XCTAssertEqual(gobanPoint.y, expectedGobanPoint.y)
        
        gobanPoint = goban.closestGobanPointFromPoint(CGPointMake(50.0, 50.0))
        expectedGobanPoint = GobanPoint(x: 5, y: 5)
        XCTAssertEqual(gobanPoint.x, expectedGobanPoint.x)
        XCTAssertEqual(gobanPoint.y, expectedGobanPoint.y)
        
        gobanPoint = goban.closestGobanPointFromPoint(CGPointMake(100.0, 100.0))
        expectedGobanPoint = GobanPoint(x: 10, y: 10)
        XCTAssertEqual(gobanPoint.x, expectedGobanPoint.x)
        XCTAssertEqual(gobanPoint.y, expectedGobanPoint.y)
        
        gobanPoint = goban.closestGobanPointFromPoint(CGPointMake(200.0, 200.0))
        expectedGobanPoint = GobanPoint(x: 19, y: 19)
        XCTAssertEqual(gobanPoint.x, expectedGobanPoint.x)
        XCTAssertEqual(gobanPoint.y, expectedGobanPoint.y)
        
        gobanPoint = goban.closestGobanPointFromPoint(CGPointMake(120.0, 40.0))
        expectedGobanPoint = GobanPoint(x: 12, y: 4)
        XCTAssertEqual(gobanPoint.x, expectedGobanPoint.x)
        XCTAssertEqual(gobanPoint.y, expectedGobanPoint.y)
        
        gobanPoint = goban.closestGobanPointFromPoint(CGPointMake(300.0, 300.0))
        expectedGobanPoint = GobanPoint(x: 19, y: 19)
        XCTAssertEqual(gobanPoint.x, expectedGobanPoint.x)
        XCTAssertEqual(gobanPoint.y, expectedGobanPoint.y)
        
        gobanPoint = goban.closestGobanPointFromPoint(CGPointMake(-1.0, -1.0))
        expectedGobanPoint = GobanPoint(x: 1, y: 1)
        XCTAssertEqual(gobanPoint.x, expectedGobanPoint.x)
        XCTAssertEqual(gobanPoint.y, expectedGobanPoint.y)
        
        gobanPoint = goban.closestGobanPointFromPoint(CGPointMake(-100.0, -100.0))
        expectedGobanPoint = GobanPoint(x: 1, y: 1)
        XCTAssertEqual(gobanPoint.x, expectedGobanPoint.x)
        XCTAssertEqual(gobanPoint.y, expectedGobanPoint.y)
        
        gobanPoint = goban.closestGobanPointFromPoint(CGPointMake(-100.0, 500.0))
        expectedGobanPoint = GobanPoint(x: 1, y: 19)
        XCTAssertEqual(gobanPoint.x, expectedGobanPoint.x)
        XCTAssertEqual(gobanPoint.y, expectedGobanPoint.y)
        
        goban = GobanView(size: GobanSize(width: 50, height: 20), frame: CGRectMake(0.0, 0.0, 100.0, 200.0))
        
        gobanPoint = goban.closestGobanPointFromPoint(CGPointZero)
        expectedGobanPoint = GobanPoint(x: 1, y: 1)
        XCTAssertEqual(gobanPoint.x, expectedGobanPoint.x)
        XCTAssertEqual(gobanPoint.y, expectedGobanPoint.y)
        
        gobanPoint = goban.closestGobanPointFromPoint(CGPointMake(50.0, 50.0))
        expectedGobanPoint = GobanPoint(x: 26, y: 5)
        XCTAssertEqual(gobanPoint.x, expectedGobanPoint.x)
        XCTAssertEqual(gobanPoint.y, expectedGobanPoint.y)
        
        gobanPoint = goban.closestGobanPointFromPoint(CGPointMake(100.0, 100.0))
        expectedGobanPoint = GobanPoint(x: 50, y: 11)
        XCTAssertEqual(gobanPoint.x, expectedGobanPoint.x)
        XCTAssertEqual(gobanPoint.y, expectedGobanPoint.y)
        
        gobanPoint = goban.closestGobanPointFromPoint(CGPointMake(200.0, 200.0))
        expectedGobanPoint = GobanPoint(x: 50, y: 20)
        XCTAssertEqual(gobanPoint.x, expectedGobanPoint.x)
        XCTAssertEqual(gobanPoint.y, expectedGobanPoint.y)
        
        gobanPoint = goban.closestGobanPointFromPoint(CGPointMake(120.0, 40.0))
        expectedGobanPoint = GobanPoint(x: 50, y: 4)
        XCTAssertEqual(gobanPoint.x, expectedGobanPoint.x)
        XCTAssertEqual(gobanPoint.y, expectedGobanPoint.y)
        
        gobanPoint = goban.closestGobanPointFromPoint(CGPointMake(300.0, 300.0))
        expectedGobanPoint = GobanPoint(x: 50, y: 20)
        XCTAssertEqual(gobanPoint.x, expectedGobanPoint.x)
        XCTAssertEqual(gobanPoint.y, expectedGobanPoint.y)
        
        gobanPoint = goban.closestGobanPointFromPoint(CGPointMake(-1.0, -1.0))
        expectedGobanPoint = GobanPoint(x: 1, y: 1)
        XCTAssertEqual(gobanPoint.x, expectedGobanPoint.x)
        XCTAssertEqual(gobanPoint.y, expectedGobanPoint.y)
        
        gobanPoint = goban.closestGobanPointFromPoint(CGPointMake(-100.0, -100.0))
{'fraction_non_alphanumeric': 0.1009080706050403, 'fraction_numerical': 0.039791857973676154, 'mean_word_length': 3.0961136648558294, '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': '2496074', 'n_tokens_mistral': 3910, 'n_tokens_neox': 3623, 'n_words': 504}