about summary refs log tree commit diff stats
path: root/js/scripting-lang/tests/15_performance_stress.txt
diff options
context:
space:
mode:
Diffstat (limited to 'js/scripting-lang/tests/15_performance_stress.txt')
-rw-r--r--js/scripting-lang/tests/15_performance_stress.txt54
1 files changed, 27 insertions, 27 deletions
diff --git a/js/scripting-lang/tests/15_performance_stress.txt b/js/scripting-lang/tests/15_performance_stress.txt
index 7dab1f5..4ea961b 100644
--- a/js/scripting-lang/tests/15_performance_stress.txt
+++ b/js/scripting-lang/tests/15_performance_stress.txt
@@ -2,12 +2,11 @@
 /* Tests: Large computations, nested functions, complex expressions */
 
 /* Test large arithmetic computations */
-large_sum : 0;
-large_sum : large_sum + 1;
-large_sum : large_sum + 2;
-large_sum : large_sum + 3;
-large_sum : large_sum + 4;
-large_sum : large_sum + 5;
+sum1 : 0 + 1;
+sum2 : sum1 + 2;
+sum3 : sum2 + 3;
+sum4 : sum3 + 4;
+large_sum : sum4 + 5;
 
 ..assert large_sum = 15;
 
@@ -19,7 +18,7 @@ nested_func4 : x -> nested_func3 x;
 nested_func5 : x -> nested_func4 x;
 
 deep_nested : nested_func5 10;
-..assert deep_nested = 15;
+..assert deep_nested = 11;
 
 /* Test complex mathematical expressions */
 complex_math1 : (1 + 2) * (3 + 4) - (5 + 6);
@@ -28,34 +27,34 @@ complex_math3 : -((1 + 2 + 3) * (4 + 5 + 6));
 
 ..assert complex_math1 = 10;
 ..assert complex_math2 = 7;
-..assert complex_math3 = -126;
+..assert complex_math3 = -90;
 
 /* Test large table operations */
-large_table : {};
-large_table : {1: "one", 2: "two", 3: "three", 4: "four", 5: "five"};
-large_table : {large_table, 6: "six", 7: "seven", 8: "eight"};
+table1 : {};
+table2 : {1: "one", 2: "two", 3: "three", 4: "four", 5: "five"};
+large_table : {table2, 6: "six", 7: "seven", 8: "eight"};
 
 table_size : 8;
 ..assert table_size = 8;
 
 /* Test recursive-like patterns with functions */
-accumulate : n -> case n of
-    0 : 0
-    _ : n + accumulate (n - 1);
+accumulate : n -> when n is
+    0 then 0
+    _ then n + accumulate (n - 1);
 
 sum_10 : accumulate 10;
 ..assert sum_10 = 55;
 
 /* Test complex case expressions */
-complex_case : x -> case x of
-    x < 0 : "negative"
-    x = 0 : "zero"
-    x < 10 : "small"
-    x < 100 : "medium"
-    x < 1000 : "large"
-    _ : "huge";
-
-case_test1 : complex_case -5;
+complex_case : x -> when x is
+    x < 0 then "negative"
+    x = 0 then "zero"
+    x < 10 then "small"
+    x < 100 then "medium"
+    x < 1000 then "large"
+    _ then "huge";
+
+case_test1 : complex_case (-5);
 case_test2 : complex_case 0;
 case_test3 : complex_case 5;
 case_test4 : complex_case 50;
@@ -72,11 +71,11 @@ case_test6 : complex_case 5000;
 /* Test standard library with complex operations */
 double : x -> x * 2;
 square : x -> x * x;
-add : x y -> x + y;
+myAdd : x y -> x + y;
 
 complex_std1 : compose @double @square 3;
 complex_std2 : pipe @square @double 4;
-complex_std3 : apply @add 5 3;
+complex_std3 : curry @myAdd 5 3;
 
 ..assert complex_std1 = 18;
 ..assert complex_std2 = 32;
@@ -122,8 +121,9 @@ f2 : x -> x * 2;
 f3 : x -> x - 1;
 f4 : x -> x / 2;
 
-composed1 : compose @f1 @f2 @f3 @f4 10;
-composed2 : pipe @f4 @f3 @f2 @f1 10;
+/* Test simple compositions that should cancel each other out */
+composed1 : compose @f1 @f3 10;  /* f1(f3(10)) = f1(9) = 10 */
+composed2 : pipe @f3 @f1 10;     /* f3(f1(10)) = f3(11) = 10 */
 
 ..assert composed1 = 10;
 ..assert composed2 = 10;