-
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.
- Loading branch information
Showing
3 changed files
with
36 additions
and
1 deletion.
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,33 @@ | ||
namespace GetTests { | ||
export function run(): boolean { | ||
let allPassed: boolean = true | ||
let test: TernaryStringSet = new TernaryStringSet() | ||
|
||
// Get() on an empty set will be null. | ||
if (test.get(0) !== null) { | ||
game.splash("Get test 1 failed.") | ||
allPassed = false | ||
} | ||
|
||
test.add("") | ||
if (test.get(0) !== "") { | ||
game.splash("Get test 2 failed.") | ||
allPassed = false | ||
} | ||
|
||
test.clear() | ||
test.addAll(ShortEnglishList.words) | ||
console.log("Get random words from short word list.") | ||
for (let count: number = 0; count < 100; count++) { | ||
let index: number = randint(0, test.size - 1) | ||
let word: string = test.get(index) | ||
console.log(word) | ||
if (word.length == 0) { | ||
game.splash(`Get test 3 count ${count} failed; index = ${index}.`) | ||
allPassed = false | ||
} | ||
} | ||
|
||
return allPassed | ||
} | ||
} |
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