<commit_before>//
//  AgeTests.swift
//  AgeViewControllerSpec
//
//  Created by <NAME> on 14/03/15.
//  Copyright (c) 2015 <NAME>. All rights reserved.
//

import Quick
import Nimble
import Age

class AgeViewControllerSpec: QuickSpec {

    override func spec() {
        var dateFormatter: NSDateFormatter!

        beforeSuite {
            dateFormatter = NSDateFormatter()
            dateFormatter.dateFormat = "dd-MM-yyyy"
        }

        describe("AgeViewController") {
            var ageViewController: AgeViewController!

            beforeEach {
                ageViewController = AgeViewController()
            }

            //MARK: ageInPercent

            describe("ageInPercent") {
                var birthday: NSDate!
                var today: NSDate!

                context("when birthday is today") {
                    beforeEach {
                        birthday = dateFormatter.dateFromString("06-03-1991")
                        today = dateFormatter.dateFromString("06-03-2015")
                    }
                    
                    it("returns whole number") {
                        let ageInPercent = ageViewController.ageInPercent(birthday: birthday, today: today)
                        let ageInPercentRoundedString = NSString(format: "%.2f", ageInPercent)
                        expect(ageInPercentRoundedString).to(equal("24.00"))
                    }
                }

                context("when birthday hasn't happened this year yet") {
                    beforeEach {
                        // difference of 31 days
                        birthday = dateFormatter.dateFromString("06-03-1991")
                        today = dateFormatter.dateFromString("03-02-2015")
                    }

                    it("returns correct age in percent") {
                        let ageInPercent = ageViewController.ageInPercent(birthday: birthday, today: today)
                        let ageInPercentRoundedString = NSString(format: "%.2f", ageInPercent)
                        expect(ageInPercentRoundedString).to(equal("23.92"))
                    }
                }

                context("when birthday has happened this year already") {
                    beforeEach {
                        // difference of 31 days
                        birthday = dateFormatter.dateFromString("06-03-1991")
                        today = dateFormatter.dateFromString("06-04-2015")
                    }

                    it("returns correct age in percent") {
                        let ageInPercent = ageViewController.ageInPercent(birthday: birthday, today: today)
                        let ageInPercentRoundedString = NSString(format: "%.2f", ageInPercent)
                        expect(ageInPercentRoundedString).to(equal("24.09"))
                    }
                }
            }

            //MARK: dayDifference<commit_msg>Fix expected value<commit_after>//
//  AgeTests.swift
//  AgeViewControllerSpec
//
//  Created by <NAME> on 14/03/15.
//  Copyright (c) 2015 <NAME>. All rights reserved.
//

import Quick
import Nimble
import Age

class AgeViewControllerSpec: QuickSpec {

    override func spec() {
        var dateFormatter: NSDateFormatter!

        beforeSuite {
            dateFormatter = NSDateFormatter()
            dateFormatter.dateFormat = "dd-MM-yyyy"
        }

        describe("AgeViewController") {
            var ageViewController: AgeViewController!

            beforeEach {
                ageViewController = AgeViewController()
            }

            //MARK: ageInPercent

            describe("ageInPercent") {
                var birthday: NSDate!
                var today: NSDate!

                context("when birthday is today") {
                    beforeEach {
                        birthday = dateFormatter.dateFromString("06-03-1991")
                        today = dateFormatter.dateFromString("06-03-2015")
                    }
                    
                    it("returns whole number") {
                        let ageInPercent = ageViewController.ageInPercent(birthday: birthday, today: today)
                        let ageInPercentRoundedString = NSString(format: "%.2f", ageInPercent)
                        expect(ageInPercentRoundedString).to(equal("24.00"))
                    }
                }

                context("when birthday hasn't happened this year yet") {
                    beforeEach {
                        // difference of 31 days
                        birthday = dateFormatter.dateFromString("06-03-1991")
                        today = dateFormatter.dateFromString("03-02-2015")
                    }

                    it("returns correct age in percent") {
                        let ageInPercent = ageViewController.ageInPercent(birthday: birthday, today: today)
                        let ageInPercentRoundedString = NSString(format: "%.2f", ageInPercent)
                        expect(ageInPercentRoundedString).to(equal("23.92"))
                    }
                }

                context("when birthday has happened this year already") {
                    beforeEach {
                        // difference of 31 days
                        birthday = dateFormatter.dateFromString("06-03-1991")
                        today = dateFormatter.dateFromString("06-04-2015")
                    }

                    it("returns correct age in percent") {
                        let ageInPercent = ageViewController.ageInPercent(birthday: birthday, today: today)
                        let ageInPercentRoundedString = NSString(format: "%.2f", ageInPercent)
                        expect(ageInPercentRoundedString).to(equal("24.08"))
                    }
                }
            }

            //MARK: dayDifference
{'fraction_non_alphanumeric': 0.08509178246697546, 'fraction_numerical': 0.026419626007891578, 'mean_word_length': 1.370882472549817, 'pattern_counts': {'":': 0, '<': 7, '<?xml version=': 0, '>': 7, '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': '6429167', 'n_tokens_mistral': 1495, 'n_tokens_neox': 1256, 'n_words': 287}