Add simple tests

This commit is contained in:
Gunay Mert Karadogan 2015-07-05 15:56:37 +02:00
parent a6adcc50c5
commit 295cb1e9ac
2 changed files with 26 additions and 17 deletions

View File

@ -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;
};

View File

@ -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")
}
}