<commit_before>//
//  CGVectorTests.swift
//  Graphicz
//
//  Created by <NAME> on 11/16/15.
//
//

import XCTest
@testable import Graphicz


class CGVectorTests: XCTestCase {
    
    /**
        Properties
    */
    
    func testMagnitude() {
        
        let vector = CGVector(dx: 30, dy: 40)
        XCTAssertEqual(vector.magnitude, 50)
    }
    
    func testAngle() {
        
        let vector0 = CGVector(dx: 0, dy: 0)
        XCTAssertEqual(vector0.angle, 0)
        
        let vector45 = CGVector(dx: 30, dy: 30)
        XCTAssertEqual(vector45.angle, CGFloat(M_PI_4))

        let vector90 = CGVector(dx: 0, dy: 20)
        XCTAssertEqual(vector90.angle, CGFloat(M_PI_2))

        let vector180 = CGVector(dx: -30, dy: 0)
        XCTAssertEqual(vector180.angle, CGFloat(M_PI))
    }
    
    
    /**
        Initializers
    */
    
    func testInitAngle() {
        
        let vector0 = CGVector(angle: 0)
        XCTAssertEqual(vector0, CGVector(dx: 1.0, dy: 0.0))
        
        let vector90 = CGVector(angle: CGFloat(M_PI_2))
        XCTAssertEqualWithAccuracy(vector90.dx, 0.0, accuracy: 0.0001)
        XCTAssertEqualWithAccuracy(vector90.dy, 1.0, accuracy: 0.0001)
        
        let vector180 = CGVector(angle: CGFloat(M_PI))
        XCTAssertEqualWithAccuracy(vector180.dx, -1, accuracy: 0.0001)
        XCTAssertEqualWithAccuracy(vector180.dy, 0, accuracy: 0.0001)
    }
}
<commit_msg>relax float test accuracy<commit_after>//
//  CGVectorTests.swift
//  Graphicz
//
//  Created by <NAME> on 11/16/15.
//
//

import XCTest
@testable import Graphicz


class CGVectorTests: XCTestCase {
    
    private let accuracy: CGFloat = 0.0001
    
    /**
        Properties
    */
    
    func testMagnitude() {
        
        let vector = CGVector(dx: 30, dy: 40)
        XCTAssertEqualWithAccuracy(vector.magnitude, 50, accuracy: accuracy)
    }
    
    func testAngle() {
        
        let vector0 = CGVector(dx: 0, dy: 0)
        XCTAssertEqualWithAccuracy(vector0.angle, 0, accuracy: accuracy)
        
        let vector45 = CGVector(dx: 30, dy: 30)
        XCTAssertEqualWithAccuracy(vector45.angle, CGFloat(M_PI_4), accuracy: accuracy)

        let vector90 = CGVector(dx: 0, dy: 20)
        XCTAssertEqualWithAccuracy(vector90.angle, CGFloat(M_PI_2), accuracy: accuracy)

        let vector180 = CGVector(dx: -30, dy: 0)
        XCTAssertEqualWithAccuracy(vector180.angle, CGFloat(M_PI), accuracy: accuracy)
    }
    
    
    /**
        Initializers
    */
    
    func testInitAngle() {
        
        let vector0 = CGVector(angle: 0)
        XCTAssertEqualWithAccuracy(vector0.dx, 1.0, accuracy: accuracy)
        XCTAssertEqualWithAccuracy(vector0.dy, 0.0, accuracy: accuracy)
        
        let vector90 = CGVector(angle: CGFloat(M_PI_2))
        XCTAssertEqualWithAccuracy(vector90.dx, 0.0, accuracy: accuracy)
        XCTAssertEqualWithAccuracy(vector90.dy, 1.0, accuracy: accuracy)
        
        let vector180 = CGVector(angle: CGFloat(M_PI))
        XCTAssertEqualWithAccuracy(vector180.dx, -1, accuracy: accuracy)
        XCTAssertEqualWithAccuracy(vector180.dy, 0, accuracy: accuracy)
    }
}

{'fraction_non_alphanumeric': 0.10727848101265823, 'fraction_numerical': 0.05379746835443038, 'mean_word_length': 2.323869610935857, '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': '7237528', 'n_tokens_mistral': 1222, 'n_tokens_neox': 1062, 'n_words': 215}