diff options
Diffstat (limited to 'js/scripting-lang/comprehensive_test.txt')
-rw-r--r-- | js/scripting-lang/comprehensive_test.txt | 128 |
1 files changed, 0 insertions, 128 deletions
diff --git a/js/scripting-lang/comprehensive_test.txt b/js/scripting-lang/comprehensive_test.txt deleted file mode 100644 index 3ff5305..0000000 --- a/js/scripting-lang/comprehensive_test.txt +++ /dev/null @@ -1,128 +0,0 @@ -x : 5; -y : 3; -name : "Alice"; -age : 25; - -..out "Basic arithmetic:"; -sum : x + y; -diff : x - y; -product : x * y; -quotient : x / y; -..out sum; -..out diff; -..out product; -..out quotient; - -..out "Variables:"; -..out name; -..out age; - -add : x y -> x + y; -double : x -> x * 2; -square : x -> x * x; - -..out "Functions:"; -result1 : add 3 4; -result2 : double 5; -result3 : square 4; -..out result1; -..out result2; -..out result3; - -compare : x y -> - case x y of - 0 0 : "both zero" - 0 _ : "x is zero" - _ 0 : "y is zero" - _ _ : "neither zero"; - -grade : score -> - case score of - 95 : "A" - 85 : "B" - 75 : "C" - 65 : "D" - _ : "F"; - -..out "Pattern matching:"; -test1 : compare 0 0; -test2 : compare 0 5; -test3 : compare 5 0; -test4 : compare 5 5; -..out test1; -..out test2; -..out test3; -..out test4; - -grade1 : grade 95; -grade2 : grade 85; -grade3 : grade 75; -grade4 : grade 65; -grade5 : grade 55; -..out grade1; -..out grade2; -..out grade3; -..out grade4; -..out grade5; - -countdown : n -> - case n of - 0 : 0 - _ : countdown n - 1; - -factorial : n -> - case n of - 0 : 1 - 1 : 1 - _ : n * factorial n - 1; - -..out "Recursion:"; -count : countdown 3; -fact : factorial 5; -..out count; -..out fact; - -..out "Input/Output demo:"; -..out "Hello, World!"; -..out 42; -..out "The sum of x and y is:"; -..out sum; - -complex : add double 3 square 2; -..out "Complex expression:"; -..out complex; - -..out "Testing assertions:"; -..assert x == 5; -..assert y == 3; -..assert sum == 8; -..assert "hello" == "hello"; -..assert add 3 4 == 7; - -..out "Testing first-class functions:"; -compose : f g x -> f g x; -apply : f x -> f x; - -composed : compose @double @square 3; -applied : apply @double 5; - -..assert composed == 18; -..assert applied == 10; - -..out "First-class functions:"; -..out composed; -..out applied; - -..out "Testing higher-order functions:"; -map : f x -> f x; -mapped1 : map @double 3; -mapped2 : map @square 4; - -..assert mapped1 == 6; -..assert mapped2 == 16; - -..out "Map results:"; -..out mapped1; -..out mapped2; - -..out "All tests completed successfully!"; \ No newline at end of file |