Created
January 4, 2018 08:06
-
-
Save stefc/deb5ce51c9cc91df3ed97965050b85eb to your computer and use it in GitHub Desktop.
Unit Test for IntPow functions
This file contains 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
import XCTest | |
import xProcs | |
class IntTests: XCTestCase { | |
func testIntPow() { | |
XCTAssertEqual(IntPow(5, exp: 2), 25) | |
XCTAssertEqual(IntPow(5, exp: 1), 5) | |
XCTAssertEqual(IntPow(5, exp: 0), 1) | |
} | |
func testIntPow10() { | |
XCTAssertEqual(IntPow10(exp: 2), 100) | |
XCTAssertEqual(IntPow10(exp: 1), 10) | |
XCTAssertEqual(IntPow10(exp: 0), 1) | |
} | |
func testIntPow2() { | |
XCTAssertEqual(IntPow2(exp: 8), 256) | |
XCTAssertEqual(IntPow2(exp: 1), 2) | |
XCTAssertEqual(IntPow2(exp: 0), 1) | |
} | |
static var allTests = [ | |
("testIntPow", testIntPow), | |
("testIntPow10", testIntPow10), | |
("testIntPow2", testIntPow2), | |
] | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment