<commit_before>//
//  SwiftyNotificationsTests.swift
//  SwiftyNotificationsTests
//
//  Created by <NAME> on 27/03/2017.
//  Copyright © 2017 <NAME>. All rights reserved.
//

import XCTest

@testable import SwiftyNotifications

class SwiftyNotificationsTests: XCTestCase {

    func testInstanceFromNib() {
        let swiftNotifications = SwiftyNotifications.instanceFromNib() as! SwiftyNotifications
        XCTAssertNotNil(swiftNotifications)
        XCTAssertNotNil(swiftNotifications.leftAccessoryView)
        XCTAssertNotNil(swiftNotifications.titleLabel)
        XCTAssertNotNil(swiftNotifications.subtitleLabel)
    }

    func testSetTitleAndSubtitle_whenSubtitleIsEmpty() {
        let swiftNotifications = SwiftyNotifications.instanceFromNib() as! SwiftyNotifications
        XCTAssertNotNil(swiftNotifications)
        swiftNotifications.setTitle(title: "Title", subtitle: nil)
        XCTAssertEqual(swiftNotifications.titleLabel.text, "Title")
        XCTAssertEqual(swiftNotifications.titleLabelTopConstraint.constant, 32)
        XCTAssertTrue(swiftNotifications.subtitleLabel.isHidden)
    }

    func testSetTitleAndSubtitle_whenSubtitleNotEmpty() {
        let swiftNotifications = SwiftyNotifications.instanceFromNib() as! SwiftyNotifications
        XCTAssertNotNil(swiftNotifications)
        swiftNotifications.setTitle(title: "Title", subtitle: "Subtitle")
        XCTAssertEqual(swiftNotifications.titleLabel.text, "Title")
        XCTAssertEqual(swiftNotifications.titleLabelTopConstraint.constant, 10)
        XCTAssertEqual(swiftNotifications.subtitleLabel.text, "Subtitle")
        XCTAssertFalse(swiftNotifications.subtitleLabel.isHidden)
    }

    func testSetTitleAndSubtitle_withEmptySubtitle_thenNotEmptySubtitle() {
        let swiftNotifications = SwiftyNotifications.instanceFromNib() as! SwiftyNotifications
        XCTAssertNotNil(swiftNotifications)
        swiftNotifications.setTitle(title: "Title", subtitle: nil)
        XCTAssertEqual(swiftNotifications.titleLabel.text, "Title")
        XCTAssertEqual(swiftNotifications.titleLabelTopConstraint.constant, 32)
        swiftNotifications.setTitle(title: "Title", subtitle: "Subtitle")
        XCTAssertFalse(swiftNotifications.subtitleLabel.isHidden)
        XCTAssertEqual(swiftNotifications.titleLabel.text, "Title")
        XCTAssertEqual(swiftNotifications.titleLabelTopConstraint.constant, 10)
        XCTAssertEqual(swiftNotifications.subtitleLabel.text, "Subtitle")
        XCTAssertFalse(swiftNotifications.subtitleLabel.isHidden)
    }
    
}
<commit_msg>- add setup<commit_after>//
//  SwiftyNotificationsTests.swift
//  SwiftyNotificationsTests
//
//  Created by <NAME> on 27/03/2017.
//  Copyright © 2017 <NAME>. All rights reserved.
//

import XCTest

@testable import SwiftyNotifications

class SwiftyNotificationsTests: XCTestCase {

    var swiftNotifications: SwiftyNotifications!

    override func setUp() {
        swiftNotifications = SwiftyNotifications.instanceFromNib() as! SwiftyNotifications
    }

    func testInstanceFromNib() {
        XCTAssertNotNil(swiftNotifications)
        XCTAssertNotNil(swiftNotifications.leftAccessoryView)
        XCTAssertNotNil(swiftNotifications.titleLabel)
        XCTAssertNotNil(swiftNotifications.subtitleLabel)
    }

    func testSetTitleAndSubtitle_whenSubtitleIsEmpty() {
        XCTAssertNotNil(swiftNotifications)
        swiftNotifications.setTitle(title: "Title", subtitle: nil)
        XCTAssertEqual(swiftNotifications.titleLabel.text, "Title")
        XCTAssertEqual(swiftNotifications.titleLabelTopConstraint.constant, 32)
        XCTAssertTrue(swiftNotifications.subtitleLabel.isHidden)
    }

    func testSetTitleAndSubtitle_whenSubtitleNotEmpty() {
        XCTAssertNotNil(swiftNotifications)
        swiftNotifications.setTitle(title: "Title", subtitle: "Subtitle")
        XCTAssertEqual(swiftNotifications.titleLabel.text, "Title")
        XCTAssertEqual(swiftNotifications.titleLabelTopConstraint.constant, 10)
        XCTAssertEqual(swiftNotifications.subtitleLabel.text, "Subtitle")
        XCTAssertFalse(swiftNotifications.subtitleLabel.isHidden)
    }

    func testSetTitleAndSubtitle_withEmptySubtitle_thenNotEmptySubtitle() {
        XCTAssertNotNil(swiftNotifications)
        swiftNotifications.setTitle(title: "Title", subtitle: nil)
        XCTAssertEqual(swiftNotifications.titleLabel.text, "Title")
        XCTAssertEqual(swiftNotifications.titleLabelTopConstraint.constant, 32)
        swiftNotifications.setTitle(title: "Title", subtitle: "Subtitle")
        XCTAssertFalse(swiftNotifications.subtitleLabel.isHidden)
        XCTAssertEqual(swiftNotifications.titleLabel.text, "Title")
        XCTAssertEqual(swiftNotifications.titleLabelTopConstraint.constant, 10)
        XCTAssertEqual(swiftNotifications.subtitleLabel.text, "Subtitle")
        XCTAssertFalse(swiftNotifications.subtitleLabel.isHidden)
    }
    
}

{'fraction_non_alphanumeric': 0.07933279088689991, 'fraction_numerical': 0.008136696501220505, 'mean_word_length': 4.5, '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': '3867757', 'n_tokens_mistral': 1485, 'n_tokens_neox': 1393, 'n_words': 188}