Last active
January 9, 2017 17:06
-
-
Save gjones/589a97e4c287a108ce88379f62772945 to your computer and use it in GitHub Desktop.
Simple Unit Test
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// Project: ExampleTestApp | |
// ViewController.swift | |
func isNumberEven(num: Int) -> Bool { | |
if num %2 == 0 { | |
return true | |
} else { | |
return false | |
} | |
} | |
// ViewControllerTests.swift | |
import XCTest | |
@testable import ExampleTestApp | |
class ViewControllerTests: XCTestCase { | |
func testIsNumberEven() { | |
let viewController = ViewController() | |
let odd = 5 | |
let even = 4 | |
XCTAssertTrue(viewController.isNumberEven(num: even)) | |
XCTAssertFalse(viewController.isNumberEven(num: odd)) | |
} | |
// Test should pass |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment