-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Added normalizedArray and indexArray.
- Loading branch information
Olcay Taner YILDIZ
committed
Sep 3, 2022
1 parent
b0fd9a4
commit 8cf0ad6
Showing
3 changed files
with
42 additions
and
33 deletions.
There are no files selected for viewing
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
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,28 @@ | ||
import XCTest | ||
@testable import Util | ||
|
||
final class RandomArrayTest: XCTestCase { | ||
|
||
func testNormalizedArray() { | ||
let array : [Double] = RandomArray.normalizedArray(itemCount: 10) | ||
var sum : Double = 0.0 | ||
for d in array{ | ||
sum += d | ||
} | ||
XCTAssertEqual(1.0, sum) | ||
} | ||
|
||
func testIndexArray() { | ||
let array : [Int] = RandomArray.indexArray(itemCount: 10) | ||
var sum : Int = 0 | ||
for d in array{ | ||
sum += d | ||
} | ||
XCTAssertEqual(45, sum) | ||
} | ||
|
||
static var allTests = [ | ||
("testExample1", testNormalizedArray), | ||
("testExample2", testIndexArray), | ||
] | ||
} |
This file was deleted.
Oops, something went wrong.