about summary refs log tree commit diff stats
path: root/js/scripting-lang/scratch_tests/test_simple_verification.txt
diff options
context:
space:
mode:
Diffstat (limited to 'js/scripting-lang/scratch_tests/test_simple_verification.txt')
-rw-r--r--js/scripting-lang/scratch_tests/test_simple_verification.txt51
1 files changed, 51 insertions, 0 deletions
diff --git a/js/scripting-lang/scratch_tests/test_simple_verification.txt b/js/scripting-lang/scratch_tests/test_simple_verification.txt
new file mode 100644
index 0000000..2abdc0f
--- /dev/null
+++ b/js/scripting-lang/scratch_tests/test_simple_verification.txt
@@ -0,0 +1,51 @@
+/* Simple verification test for enhanced case statements */
+
+/* Test 1: Basic table creation */
+basic : {1, 2, 3};
+..out "Basic table:";
+..out basic;
+
+/* Test 2: Auto-indexed table with expressions */
+expr : {5 % 3, 5 % 5};
+..out "Expression table:";
+..out expr;
+
+/* Test 3: Map with equals 0 */
+mapped : map @(equals 0) {15 % 3, 15 % 5};
+..out "Mapped table:";
+..out mapped;
+
+/* Test 4: Simple table pattern matching */
+test_table : {1: true, 2: false};
+result : when test_table is
+    {1: true, 2: true} then "both true"
+    {1: true, 2: false} then "first true"
+    {1: false, 2: true} then "second true"
+    {1: false, 2: false} then "both false";
+..out "Pattern match result:";
+..out result;
+
+/* Test 5: FizzBuzz divisibility function */
+divisibility : n -> map @(equals 0) {n % 3, n % 5};
+div_15 : divisibility 15;
+..out "Divisibility for 15:";
+..out div_15;
+
+/* Test 6: Complete FizzBuzz */
+fizzbuzz : n ->
+  when divisibility n is
+    {1: true, 2: true} then "FizzBuzz"
+    {1: true, 2: false} then "Fizz"
+    {1: false, 2: true} then "Buzz"
+    {1: false, 2: false} then n;
+
+fizz_15 : fizzbuzz 15;
+fizz_3 : fizzbuzz 3;
+fizz_5 : fizzbuzz 5;
+fizz_7 : fizzbuzz 7;
+
+..out "FizzBuzz results:";
+..out "15: " + fizz_15;
+..out "3: " + fizz_3;
+..out "5: " + fizz_5;
+..out "7: " + fizz_7; 
\ No newline at end of file