Created
March 24, 2021 23:06
-
-
Save PraveenKommuri/231e5bd79bb81f8567e616abc3a49f93 to your computer and use it in GitHub Desktop.
Test your methods in playground through XCTestCase
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
import XCTest | |
// Sample class with one method in it. | |
class evenOddClass { | |
func isEvenNumber(_ number: Int) -> Bool { | |
if number % 2 == 0 { | |
return true | |
} else { | |
return false | |
} | |
} | |
} | |
// Sample test target class to check your functions. | |
class tests: XCTestCase { | |
var evenOddClassObj = evenOddClass() | |
func test1() { | |
XCTAssertEqual(evenOddClassObj.isEvenNumber(4), true) | |
} | |
func test2() { | |
XCTAssertEqual(evenOddClassObj.isEvenNumber(5), true) | |
} | |
} | |
tests.defaultTestSuite.run() |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment