From 295cb1e9acebb748b6d52aabc4406d284e56c5d8 Mon Sep 17 00:00:00 2001 From: Gunay Mert Karadogan Date: Sun, 5 Jul 2015 15:56:37 +0200 Subject: [PATCH] Add simple tests --- .../project.pbxproj | 3 ++ .../GMStepperExampleTests.swift | 40 +++++++++++-------- 2 files changed, 26 insertions(+), 17 deletions(-) diff --git a/GMStepperExample/GMStepperExample.xcodeproj/project.pbxproj b/GMStepperExample/GMStepperExample.xcodeproj/project.pbxproj index c37692d..815e072 100644 --- a/GMStepperExample/GMStepperExample.xcodeproj/project.pbxproj +++ b/GMStepperExample/GMStepperExample.xcodeproj/project.pbxproj @@ -7,6 +7,7 @@ objects = { /* Begin PBXBuildFile section */ + 3169DD3E1B496C33009791D1 /* GMStepper.swift in Sources */ = {isa = PBXBuildFile; fileRef = 319C195B1B48445E005EFEE5 /* GMStepper.swift */; }; 319C19381B4843EB005EFEE5 /* AppDelegate.swift in Sources */ = {isa = PBXBuildFile; fileRef = 319C19371B4843EB005EFEE5 /* AppDelegate.swift */; }; 319C193A1B4843EB005EFEE5 /* ViewController.swift in Sources */ = {isa = PBXBuildFile; fileRef = 319C19391B4843EB005EFEE5 /* ViewController.swift */; }; 319C193D1B4843EB005EFEE5 /* Main.storyboard in Resources */ = {isa = PBXBuildFile; fileRef = 319C193B1B4843EB005EFEE5 /* Main.storyboard */; }; @@ -168,6 +169,7 @@ 319C192A1B4843EB005EFEE5 /* Project object */ = { isa = PBXProject; attributes = { + LastSwiftUpdateCheck = 0700; LastUpgradeCheck = 0640; ORGANIZATIONNAME = "Gunay Mert Karadogan"; TargetAttributes = { @@ -235,6 +237,7 @@ buildActionMask = 2147483647; files = ( 319C194E1B4843EB005EFEE5 /* GMStepperExampleTests.swift in Sources */, + 3169DD3E1B496C33009791D1 /* GMStepper.swift in Sources */, ); runOnlyForDeploymentPostprocessing = 0; }; diff --git a/GMStepperExample/GMStepperExampleTests/GMStepperExampleTests.swift b/GMStepperExample/GMStepperExampleTests/GMStepperExampleTests.swift index 6c0438f..df8d251 100644 --- a/GMStepperExample/GMStepperExampleTests/GMStepperExampleTests.swift +++ b/GMStepperExample/GMStepperExampleTests/GMStepperExampleTests.swift @@ -10,27 +10,33 @@ import UIKit import XCTest class GMStepperExampleTests: XCTestCase { - + var stepper: GMStepper! + override func setUp() { super.setUp() - // Put setup code here. This method is called before the invocation of each test method in the class. + stepper = GMStepper() } - - override func tearDown() { - // Put teardown code here. This method is called after the invocation of each test method in the class. - super.tearDown() + + func testDefaults() { + XCTAssert(stepper.minimumValue == 0, "minimumValue defaults 0") + XCTAssert(stepper.maximumValue == 10, "maximumValue defaults to 10") + XCTAssert(stepper.value == 0, "value defaults to 0") } - - func testExample() { - // This is an example of a functional test case. - XCTAssert(true, "Pass") + + func testMinimum_limitsValue() { + stepper.minimumValue = 1 + stepper.value = 0 + + XCTAssert(stepper.value == stepper.minimumValue, "Pass") } - - func testPerformanceExample() { - // This is an example of a performance test case. - self.measureBlock() { - // Put the code you want to measure the time of here. - } + + func testMaximum_limitsValue() { + let stepper = GMStepper() + stepper.maximumValue = 1 + stepper.value = 2 + + XCTAssert(stepper.value == stepper.maximumValue, "Pass") } - + + }