diff options
Diffstat (limited to 'js/scripting-lang/scratch_tests/test_enhanced_case_final.txt')
-rw-r--r-- | js/scripting-lang/scratch_tests/test_enhanced_case_final.txt | 62 |
1 files changed, 0 insertions, 62 deletions
diff --git a/js/scripting-lang/scratch_tests/test_enhanced_case_final.txt b/js/scripting-lang/scratch_tests/test_enhanced_case_final.txt deleted file mode 100644 index 4551122..0000000 --- a/js/scripting-lang/scratch_tests/test_enhanced_case_final.txt +++ /dev/null @@ -1,62 +0,0 @@ -/* Final 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 */ -/* Work around parser limitation by using variables */ -a : 5 % 3; -b : 5 % 5; -expr : {a, b}; -..out "Expression table:"; -..out expr; - -/* Test 3: Map with equals 0 */ -/* Work around parser limitation by using variables */ -c : 15 % 3; -d : 15 % 5; -is_zero : x -> x = 0; -mapped : map @is_zero {c, d}; -..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 */ -/* Work around parser limitation by using a helper function */ -mod3 : n -> n % 3; -mod5 : n -> n % 5; -divisibility : n -> map @is_zero {mod3 n, mod5 n}; - -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 |