on master help sign in
Add simple tests
295cb1eGunay Mert Karadogan
GMStepperExample/GMStepperExample.xcodeproj/project.pbxproj+3
@@ -7,6 +7,7 @@
7 objects = {
7 objects = {
8
8
9/* Begin PBXBuildFile section */
9/* Begin PBXBuildFile section */
10+ 3169DD3E1B496C33009791D1 /* GMStepper.swift in Sources */ = {isa = PBXBuildFile; fileRef = 319C195B1B48445E005EFEE5 /* GMStepper.swift */; };
10 319C19381B4843EB005EFEE5 /* AppDelegate.swift in Sources */ = {isa = PBXBuildFile; fileRef = 319C19371B4843EB005EFEE5 /* AppDelegate.swift */; };
11 319C19381B4843EB005EFEE5 /* AppDelegate.swift in Sources */ = {isa = PBXBuildFile; fileRef = 319C19371B4843EB005EFEE5 /* AppDelegate.swift */; };
11 319C193A1B4843EB005EFEE5 /* ViewController.swift in Sources */ = {isa = PBXBuildFile; fileRef = 319C19391B4843EB005EFEE5 /* ViewController.swift */; };
12 319C193A1B4843EB005EFEE5 /* ViewController.swift in Sources */ = {isa = PBXBuildFile; fileRef = 319C19391B4843EB005EFEE5 /* ViewController.swift */; };
12 319C193D1B4843EB005EFEE5 /* Main.storyboard in Resources */ = {isa = PBXBuildFile; fileRef = 319C193B1B4843EB005EFEE5 /* Main.storyboard */; };
13 319C193D1B4843EB005EFEE5 /* Main.storyboard in Resources */ = {isa = PBXBuildFile; fileRef = 319C193B1B4843EB005EFEE5 /* Main.storyboard */; };
@@ -168,6 +169,7 @@
168 319C192A1B4843EB005EFEE5 /* Project object */ = {
169 319C192A1B4843EB005EFEE5 /* Project object */ = {
169 isa = PBXProject;
170 isa = PBXProject;
170 attributes = {
171 attributes = {
172+ LastSwiftUpdateCheck = 0700;
171 LastUpgradeCheck = 0640;
173 LastUpgradeCheck = 0640;
172 ORGANIZATIONNAME = "Gunay Mert Karadogan";
174 ORGANIZATIONNAME = "Gunay Mert Karadogan";
173 TargetAttributes = {
175 TargetAttributes = {
@@ -235,6 +237,7 @@
235 buildActionMask = 2147483647;
237 buildActionMask = 2147483647;
236 files = (
238 files = (
237 319C194E1B4843EB005EFEE5 /* GMStepperExampleTests.swift in Sources */,
239 319C194E1B4843EB005EFEE5 /* GMStepperExampleTests.swift in Sources */,
240+ 3169DD3E1B496C33009791D1 /* GMStepper.swift in Sources */,
238 );
241 );
239 runOnlyForDeploymentPostprocessing = 0;
242 runOnlyForDeploymentPostprocessing = 0;
240 };
243 };
GMStepperExample/GMStepperExampleTests/GMStepperExampleTests.swift+23−17
@@ -10,27 +10,33 @@ import UIKit
10import XCTest
10import XCTest
11
11
12class GMStepperExampleTests: XCTestCase {
12class GMStepperExampleTests: XCTestCase {
13−
13+ var stepper: GMStepper!
14+
14 override func setUp() {
15 override func setUp() {
15 super.setUp()
16 super.setUp()
16− // Put setup code here. This method is called before the invocation of each test method in the class.
17+ stepper = GMStepper()
17 }
18 }
18−
19+
19− override func tearDown() {
20+ func testDefaults() {
20− // Put teardown code here. This method is called after the invocation of each test method in the class.
21+ XCTAssert(stepper.minimumValue == 0, "minimumValue defaults 0")
21− super.tearDown()
22+ XCTAssert(stepper.maximumValue == 10, "maximumValue defaults to 10")
23+ XCTAssert(stepper.value == 0, "value defaults to 0")
22 }
24 }
23−
25+
24− func testExample() {
26+ func testMinimum_limitsValue() {
25− // This is an example of a functional test case.
27+ stepper.minimumValue = 1
28+ stepper.value = 0
29+
26− XCTAssert(true, "Pass")
30+ XCTAssert(stepper.value == stepper.minimumValue, "Pass")
27 }
31 }
28−
32+
29− func testPerformanceExample() {
33+ func testMaximum_limitsValue() {
30− // This is an example of a performance test case.
34+ let stepper = GMStepper()
31− self.measureBlock() {
35+ stepper.maximumValue = 1
32− // Put the code you want to measure the time of here.
36+ stepper.value = 2
33− }
37+
38+ XCTAssert(stepper.value == stepper.maximumValue, "Pass")
34 }
39 }
35−
40+
41+
36}
42}