<commit_before>//
//  KGNPreferredFontManagerTests.swift
//  KGNPreferredFontManagerTests
//
//  Created by <NAME> on 10/12/15.
//  Copyright © 2015 <NAME>. All rights reserved.
//

import XCTest
@testable import KGNPreferredFontManager


class KGNPreferredFontManagerFontWeightTests: XCTestCase {

    // for some reason @available(iOS 8.2, *) is not working
    func canRun() -> Bool {
        if NSProcessInfo.processInfo().operatingSystemVersion.majorVersion >= 9 {
            return true
        }
        if NSProcessInfo.processInfo().operatingSystemVersion.majorVersion >= 8 {
            if NSProcessInfo.processInfo().operatingSystemVersion.minorVersion >= 2 {
                return true
            }
        }
        return false
    }

    func testFontWeightHeadline() {
        if !self.canRun() {
            return
        }

        let fontWeight = UIFontWeightUltraLight
        let textStyle = UIFontTextStyleHeadline
        let preferredFontManager = PreferredFontManager()
        preferredFontManager.registerFontsForTextStyle(textStyle, fontWeight: fontWeight, baseFontSize: 28, increment: 2, decrement: 2)

        let sizes: [String: CGFloat] = [
            UIContentSizeCategoryExtraSmall: 22,
            UIContentSizeCategorySmall: 24,
            UIContentSizeCategoryMedium: 26,
            UIContentSizeCategoryLarge: 28,
            UIContentSizeCategoryExtraLarge: 30,
            UIContentSizeCategoryExtraExtraLarge: 32,
            UIContentSizeCategoryExtraExtraExtraLarge: 34,
            UIContentSizeCategoryAccessibilityMedium: 34,
            UIContentSizeCategoryAccessibilityLarge: 34,
            UIContentSizeCategoryAccessibilityExtraLarge: 34,
            UIContentSizeCategoryAccessibilityExtraExtraLarge: 34,
            UIContentSizeCategoryAccessibilityExtraExtraExtraLarge: 34
        ]

        for (sizeCategory, fontSize) in sizes {
            let extraSmallPreferredFont = preferredFontManager.preferredFontForTextStyle(textStyle, sizeCategory: sizeCategory)
            XCTAssertEqual(extraSmallPreferredFont, UIFont.systemFontOfSize(fontSize, weight: fontWeight))
        }
    }

    func testFontWeightSubheadline() {<commit_msg>testing a failure<commit_after>//
//  KGNPreferredFontManagerTests.swift
//  KGNPreferredFontManagerTests
//
//  Created by <NAME> on 10/12/15.
//  Copyright © 2015 <NAME>. All rights reserved.
//

import XCTest
@testable import KGNPreferredFontManager


class KGNPreferredFontManagerFontWeightTests: XCTestCase {

    // for some reason @available(iOS 8.2, *) is not working
    func canRun() -> Bool {
        if NSProcessInfo.processInfo().operatingSystemVersion.majorVersion >= 9 {
            return true
        }
        if NSProcessInfo.processInfo().operatingSystemVersion.majorVersion >= 8 {
            if NSProcessInfo.processInfo().operatingSystemVersion.minorVersion >= 2 {
                return true
            }
        }
        return false
    }

    func testFontWeightHeadline() {
        if !self.canRun() {
            return
        }

        let fontWeight = UIFontWeightUltraLight
        let textStyle = UIFontTextStyleHeadline
        let preferredFontManager = PreferredFontManager()
        preferredFontManager.registerFontsForTextStyle(textStyle, fontWeight: fontWeight, baseFontSize: 28, increment: 2, decrement: 2)

        let sizes: [String: CGFloat] = [
            UIContentSizeCategoryExtraSmall: 22,
            UIContentSizeCategorySmall: 24,
            UIContentSizeCategoryMedium: 26,
            UIContentSizeCategoryLarge: 28,
            UIContentSizeCategoryExtraLarge: 30,
            UIContentSizeCategoryExtraExtraLarge: 32,
            UIContentSizeCategoryExtraExtraExtraLarge: 34,
            UIContentSizeCategoryAccessibilityMedium: 34,
            UIContentSizeCategoryAccessibilityLarge: 34,
            UIContentSizeCategoryAccessibilityExtraLarge: 34,
            UIContentSizeCategoryAccessibilityExtraExtraLarge: 34,
            UIContentSizeCategoryAccessibilityExtraExtraExtraLarge: 34
        ]

        for (sizeCategory, fontSize) in sizes {
            let extraSmallPreferredFont = preferredFontManager.preferredFontForTextStyle(textStyle, sizeCategory: sizeCategory)
            XCTAssertEqual(extraSmallPreferredFont, UIFont.systemFontOfSize(fontSize, weight: fontWeight+1))
        }
    }

    func testFontWeightSubheadline() {
{'fraction_non_alphanumeric': 0.06837800999545661, 'fraction_numerical': 0.019763743752839617, 'mean_word_length': 2.812121212121212, 'pattern_counts': {'":': 0, '<': 7, '<?xml version=': 0, '>': 15, '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': '7544464', 'n_tokens_mistral': 1231, 'n_tokens_neox': 1150, 'n_words': 234}