-
Tips & Tricks
Code func printRandomNumber(in range: ClosedRange<Int>) { print(Int.random(in: range)) }
Test Cases import XCTest // XCTest Spec Example: // TODO: replace with your own tests (TDD), these are just how-to examples to get you started class SolutionTest: XCTestCase { static var allTests = [ ("Test Example", testExample), ] func testExample() { printRandomNumber(in: 0 ... 100) } } XCTMain([ testCase(SolutionTest.allTests) ])
Output:
-
Code import Glibcfor count in 1...20 {print(random() % 100)- func printRandomNumber(in range: ClosedRange<Int>) {
- print(Int.random(in: range))
- }
Test Cases - import XCTest
- // XCTest Spec Example:
- // TODO: replace with your own tests (TDD), these are just how-to examples to get you started
- class SolutionTest: XCTestCase {
- static var allTests = [
- ("Test Example", testExample),
- ]
- func testExample() {
- printRandomNumber(in: 0 ... 100)
- }
- }
- XCTMain([
- testCase(SolutionTest.allTests)
- ])
- All
- {{group.name}} ({{group.count}})
This comment has been reported as {{ abuseKindText }}.
Show
This comment has been hidden. You can view it now .
This comment can not be viewed.
- |
- Reply
- Edit
- View Solution
- Expand 1 Reply Expand {{ comments?.length }} replies
- Collapse
- Remove
- Remove comment & replies
- Report
{{ fetchSolutionsError }}