From f04469ea62fc53fc3ea75c9996ec6dc769f20365 Mon Sep 17 00:00:00 2001 From: Alex Kulcsar <38046796+alex-kulcsar@users.noreply.github.com> Date: Sun, 10 Nov 2024 00:29:50 -0500 Subject: [PATCH 1/2] Update extension version. --- pxt.json | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/pxt.json b/pxt.json index 6fb50ee..f29db5d 100644 --- a/pxt.json +++ b/pxt.json @@ -3,7 +3,7 @@ "version": "0.0.0", "dependencies": { "device": "*", - "pxt-fast-ternary-string-set": "github:robo-technical-group/pxt-fast-ternary-string-set#v2.1.3" + "pxt-fast-ternary-string-set": "github:robo-technical-group/pxt-fast-ternary-string-set#v2.1.4" }, "files": [ "main.ts", @@ -23,7 +23,7 @@ ], "testDependencies": {}, "targetVersions": { - "target": "1.12.56", + "target": "1.12.57", "targetId": "arcade" }, "supportedTargets": [ From 77b06c28c81ed9cb3e0d94fdb5652a0613b3ba35 Mon Sep 17 00:00:00 2001 From: Alex Kulcsar <38046796+alex-kulcsar@users.noreply.github.com> Date: Sun, 10 Nov 2024 11:55:07 -0500 Subject: [PATCH 2/2] Add get() tests. --- get.ts | 33 +++++++++++++++++++++++++++++++++ main.ts | 1 + pxt.json | 5 +++-- 3 files changed, 37 insertions(+), 2 deletions(-) create mode 100644 get.ts diff --git a/get.ts b/get.ts new file mode 100644 index 0000000..d9d955b --- /dev/null +++ b/get.ts @@ -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 + } +} \ No newline at end of file diff --git a/main.ts b/main.ts index 3f1d567..57ddfa3 100644 --- a/main.ts +++ b/main.ts @@ -15,6 +15,7 @@ let tests: (() => boolean)[] = [ Balance.run, Compact.run, Serialization.run, + GetTests.run, ] for (let t of tests) { diff --git a/pxt.json b/pxt.json index f29db5d..7f01031 100644 --- a/pxt.json +++ b/pxt.json @@ -3,7 +3,7 @@ "version": "0.0.0", "dependencies": { "device": "*", - "pxt-fast-ternary-string-set": "github:robo-technical-group/pxt-fast-ternary-string-set#v2.1.4" + "pxt-fast-ternary-string-set": "github:robo-technical-group/pxt-fast-ternary-string-set#v2.2.1" }, "files": [ "main.ts", @@ -19,7 +19,8 @@ "compact.ts", "common.ts", "serialization.ts", - "serialized-short-list.ts" + "serialized-short-list.ts", + "get.ts" ], "testDependencies": {}, "targetVersions": {