on master help sign in
Add simple tests
commit295cb1e9acebb748b6d52aabc4406d284e56c5d8 authorGunay Mert Karadogan <mertkaradogan@gmail.com> dateSun 5 Jul 2015, 15:56 (11 years ago) parenta6adcc5
2 files changed+26−17
GMStepperExample/GMStepperExample.xcodeproj/project.pbxproj+3 GMStepperExample/GMStepperExampleTests/GMStepperExampleTests.swift+23−17
GMStepperExample/GMStepperExample.xcodeproj/project.pbxproj+3
@@ -7,6 +7,7 @@
77 objects = {
88
99/* Begin PBXBuildFile section */
10+ 3169DD3E1B496C33009791D1 /* GMStepper.swift in Sources */ = {isa = PBXBuildFile; fileRef = 319C195B1B48445E005EFEE5 /* GMStepper.swift */; };
1011 319C19381B4843EB005EFEE5 /* AppDelegate.swift in Sources */ = {isa = PBXBuildFile; fileRef = 319C19371B4843EB005EFEE5 /* AppDelegate.swift */; };
1112 319C193A1B4843EB005EFEE5 /* ViewController.swift in Sources */ = {isa = PBXBuildFile; fileRef = 319C19391B4843EB005EFEE5 /* ViewController.swift */; };
1213 319C193D1B4843EB005EFEE5 /* Main.storyboard in Resources */ = {isa = PBXBuildFile; fileRef = 319C193B1B4843EB005EFEE5 /* Main.storyboard */; };
@@ -168,6 +169,7 @@
168169 319C192A1B4843EB005EFEE5 /* Project object */ = {
169170 isa = PBXProject;
170171 attributes = {
172+ LastSwiftUpdateCheck = 0700;
171173 LastUpgradeCheck = 0640;
172174 ORGANIZATIONNAME = "Gunay Mert Karadogan";
173175 TargetAttributes = {
@@ -235,6 +237,7 @@
235237 buildActionMask = 2147483647;
236238 files = (
237239 319C194E1B4843EB005EFEE5 /* GMStepperExampleTests.swift in Sources */,
240+ 3169DD3E1B496C33009791D1 /* GMStepper.swift in Sources */,
238241 );
239242 runOnlyForDeploymentPostprocessing = 0;
240243 };
GMStepperExample/GMStepperExampleTests/GMStepperExampleTests.swift+23−17
@@ -10,27 +10,33 @@ import UIKit
1010import XCTest
1111
1212class GMStepperExampleTests: XCTestCase {
13−
13+ var stepper: GMStepper!
14+
1415 override func setUp() {
1516 super.setUp()
16− // Put setup code here. This method is called before the invocation of each test method in the class.
17+ stepper = GMStepper()
1718 }
18−
19− override func tearDown() {
20− // Put teardown code here. This method is called after the invocation of each test method in the class.
21− super.tearDown()
19+
20+ func testDefaults() {
21+ XCTAssert(stepper.minimumValue == 0, "minimumValue defaults 0")
22+ XCTAssert(stepper.maximumValue == 10, "maximumValue defaults to 10")
23+ XCTAssert(stepper.value == 0, "value defaults to 0")
2224 }
23−
24− func testExample() {
25− // This is an example of a functional test case.
26− XCTAssert(true, "Pass")
25+
26+ func testMinimum_limitsValue() {
27+ stepper.minimumValue = 1
28+ stepper.value = 0
29+
30+ XCTAssert(stepper.value == stepper.minimumValue, "Pass")
2731 }
28−
29− func testPerformanceExample() {
30− // This is an example of a performance test case.
31− self.measureBlock() {
32− // Put the code you want to measure the time of here.
33− }
32+
33+ func testMaximum_limitsValue() {
34+ let stepper = GMStepper()
35+ stepper.maximumValue = 1
36+ stepper.value = 2
37+
38+ XCTAssert(stepper.value == stepper.maximumValue, "Pass")
3439 }
35−
40+
41+
3642}