about summary refs log tree commit diff stats
path: root/js/scripting-lang/tests
diff options
context:
space:
mode:
Diffstat (limited to 'js/scripting-lang/tests')
-rw-r--r--js/scripting-lang/tests/01_lexer_basic.txt25
-rw-r--r--js/scripting-lang/tests/02_arithmetic_operations.txt31
-rw-r--r--js/scripting-lang/tests/03_comparison_operators.txt33
-rw-r--r--js/scripting-lang/tests/04_logical_operators.txt35
-rw-r--r--js/scripting-lang/tests/05_io_operations.txt28
-rw-r--r--js/scripting-lang/tests/06_function_definitions.txt32
-rw-r--r--js/scripting-lang/tests/07_case_expressions.txt47
-rw-r--r--js/scripting-lang/tests/08_first_class_functions.txt51
-rw-r--r--js/scripting-lang/tests/09_tables.txt50
-rw-r--r--js/scripting-lang/tests/10_standard_library.txt49
-rw-r--r--js/scripting-lang/tests/11_edge_cases.txt50
-rw-r--r--js/scripting-lang/tests/12_advanced_tables.txt85
-rw-r--r--js/scripting-lang/tests/13_standard_library_complete.txt97
-rw-r--r--js/scripting-lang/tests/14_error_handling.txt65
-rw-r--r--js/scripting-lang/tests/15_performance_stress.txt131
-rw-r--r--js/scripting-lang/tests/16_advanced_functional.txt169
-rw-r--r--js/scripting-lang/tests/17_real_world_scenarios.txt219
-rw-r--r--js/scripting-lang/tests/integration_01_basic_features.txt37
-rw-r--r--js/scripting-lang/tests/integration_02_pattern_matching.txt64
-rw-r--r--js/scripting-lang/tests/integration_03_functional_programming.txt68
-rw-r--r--js/scripting-lang/tests/integration_04_mini_case_multi_param.txt17
21 files changed, 1383 insertions, 0 deletions
diff --git a/js/scripting-lang/tests/01_lexer_basic.txt b/js/scripting-lang/tests/01_lexer_basic.txt
new file mode 100644
index 0000000..bdf7397
--- /dev/null
+++ b/js/scripting-lang/tests/01_lexer_basic.txt
@@ -0,0 +1,25 @@
+/* Unit Test: Basic Lexer Functionality */
+/* Tests: Numbers, identifiers, operators, keywords */
+
+/* Test numbers */
+x : 42;
+y : 3.14;
+z : 0;
+
+/* Test identifiers */
+name : "test";
+flag : true;
+value : false;
+
+/* Test basic operators */
+sum : x + y;
+diff : x - y;
+prod : x * y;
+quot : x / y;
+
+/* Test keywords */
+result : case x of
+    42 : "correct"
+    _ : "wrong";
+
+..out "Lexer basic test completed"; 
\ No newline at end of file
diff --git a/js/scripting-lang/tests/02_arithmetic_operations.txt b/js/scripting-lang/tests/02_arithmetic_operations.txt
new file mode 100644
index 0000000..9c6ab37
--- /dev/null
+++ b/js/scripting-lang/tests/02_arithmetic_operations.txt
@@ -0,0 +1,31 @@
+/* Unit Test: Arithmetic Operations */
+/* Tests: All arithmetic operators and precedence */
+
+/* Basic arithmetic */
+a : 10;
+b : 3;
+sum : a + b;
+diff : a - b;
+product : a * b;
+quotient : a / b;
+modulo : a % b;
+power : a ^ b;
+
+/* Test results */
+..assert sum = 13;
+..assert diff = 7;
+..assert product = 30;
+..assert quotient = 3.3333333333333335;
+..assert modulo = 1;
+..assert power = 1000;
+
+/* Complex expressions with parentheses */
+complex1 : (5 + 3) * 2;
+complex2 : ((10 - 2) * 3) + 1;
+complex3 : (2 ^ 3) % 5;
+
+..assert complex1 = 16;
+..assert complex2 = 25;
+..assert complex3 = 3;
+
+..out "Arithmetic operations test completed"; 
\ No newline at end of file
diff --git a/js/scripting-lang/tests/03_comparison_operators.txt b/js/scripting-lang/tests/03_comparison_operators.txt
new file mode 100644
index 0000000..f122a84
--- /dev/null
+++ b/js/scripting-lang/tests/03_comparison_operators.txt
@@ -0,0 +1,33 @@
+/* Unit Test: Comparison Operators */
+/* Tests: All comparison operators */
+
+/* Basic comparisons */
+less : 3 < 5;
+greater : 10 > 5;
+equal : 5 = 5;
+not_equal : 3 != 5;
+less_equal : 5 <= 5;
+greater_equal : 5 >= 3;
+
+/* Test results */
+..assert less = true;
+..assert greater = true;
+..assert equal = true;
+..assert not_equal = true;
+..assert less_equal = true;
+..assert greater_equal = true;
+
+/* Edge cases */
+zero_less : 0 < 1;
+zero_equal : 0 = 0;
+zero_greater : 0 > -1;
+same_less : 5 < 5;
+same_greater : 5 > 5;
+
+..assert zero_less = true;
+..assert zero_equal = true;
+..assert zero_greater = true;
+..assert same_less = false;
+..assert same_greater = false;
+
+..out "Comparison operators test completed"; 
\ No newline at end of file
diff --git a/js/scripting-lang/tests/04_logical_operators.txt b/js/scripting-lang/tests/04_logical_operators.txt
new file mode 100644
index 0000000..591e04b
--- /dev/null
+++ b/js/scripting-lang/tests/04_logical_operators.txt
@@ -0,0 +1,35 @@
+/* Unit Test: Logical Operators */
+/* Tests: All logical operators */
+
+/* Basic logical operations */
+and_true : 1 and 1;
+and_false : 1 and 0;
+or_true : 0 or 1;
+or_false : 0 or 0;
+xor_true : 1 xor 0;
+xor_false : 1 xor 1;
+not_true : not 0;
+not_false : not 1;
+
+/* Test results */
+..assert and_true = true;
+..assert and_false = false;
+..assert or_true = true;
+..assert or_false = false;
+..assert xor_true = true;
+..assert xor_false = false;
+..assert not_true = true;
+..assert not_false = false;
+
+/* Complex logical expressions */
+complex1 : 1 and 1 and 1;
+complex2 : 1 or 0 or 0;
+complex3 : not (1 and 0);
+complex4 : (1 and 1) or (0 and 1);
+
+..assert complex1 = true;
+..assert complex2 = true;
+..assert complex3 = true;
+..assert complex4 = true;
+
+..out "Logical operators test completed"; 
\ No newline at end of file
diff --git a/js/scripting-lang/tests/05_io_operations.txt b/js/scripting-lang/tests/05_io_operations.txt
new file mode 100644
index 0000000..a16bf94
--- /dev/null
+++ b/js/scripting-lang/tests/05_io_operations.txt
@@ -0,0 +1,28 @@
+/* Unit Test: IO Operations */
+/* Tests: ..out, ..assert operations */
+
+/* Test basic output */
+..out "Testing IO operations";
+
+/* Test assertions */
+x : 5;
+y : 3;
+sum : x + y;
+
+..assert x = 5;
+..assert y = 3;
+..assert sum = 8;
+..assert x > 3;
+..assert y < 10;
+..assert sum != 0;
+
+/* Test string comparisons */
+..assert "hello" = "hello";
+..assert "world" != "hello";
+
+/* Test complex assertions */
+..assert (x + y) = 8;
+..assert (x * y) = 15;
+..assert (x > y) = true;
+
+..out "IO operations test completed"; 
\ No newline at end of file
diff --git a/js/scripting-lang/tests/06_function_definitions.txt b/js/scripting-lang/tests/06_function_definitions.txt
new file mode 100644
index 0000000..6ce8677
--- /dev/null
+++ b/js/scripting-lang/tests/06_function_definitions.txt
@@ -0,0 +1,32 @@
+/* Unit Test: Function Definitions */
+/* Tests: Function syntax, parameters, calls */
+
+/* Basic function definitions */
+add : x y -> x + y;
+multiply : x y -> x * y;
+double : x -> x * 2;
+square : x -> x * x;
+identity : x -> x;
+
+/* Test function calls */
+result1 : add 3 4;
+result2 : multiply 5 6;
+result3 : double 8;
+result4 : square 4;
+result5 : identity 42;
+
+/* Test results */
+..assert result1 = 7;
+..assert result2 = 30;
+..assert result3 = 16;
+..assert result4 = 16;
+..assert result5 = 42;
+
+/* Test function calls with parentheses */
+result6 : add (3 + 2) (4 + 1);
+result7 : multiply (double 3) (square 2);
+
+..assert result6 = 10;
+..assert result7 = 24;
+
+..out "Function definitions test completed"; 
\ No newline at end of file
diff --git a/js/scripting-lang/tests/07_case_expressions.txt b/js/scripting-lang/tests/07_case_expressions.txt
new file mode 100644
index 0000000..82d458c
--- /dev/null
+++ b/js/scripting-lang/tests/07_case_expressions.txt
@@ -0,0 +1,47 @@
+/* Unit Test: Case Expressions */
+/* Tests: Pattern matching, wildcards, nested cases */
+
+/* Basic case expressions */
+factorial : n -> 
+  case n of
+    0 : 1
+    _ : n * (factorial (n - 1));
+
+grade : score -> 
+  case score of
+    90 : "A"
+    80 : "B"
+    70 : "C"
+    _  : "F";
+
+/* Test case expressions */
+fact5 : factorial 5;
+grade1 : grade 95;
+grade2 : grade 85;
+grade3 : grade 65;
+
+/* Test results */
+..assert fact5 = 120;
+..assert grade1 = "F";  /* 95 doesn't match 90, so falls through to wildcard */
+..assert grade2 = "F";  /* 85 doesn't match 80, so falls through to wildcard */
+..assert grade3 = "F";
+
+/* Multi-parameter case expressions */
+compare : x y -> 
+  case x y of
+    0 0 : "both zero"
+    0 _ : "x is zero"
+    _ 0 : "y is zero"
+    _ _ : "neither zero";
+
+test1 : compare 0 0;
+test2 : compare 0 5;
+test3 : compare 5 0;
+test4 : compare 5 5;
+
+..assert test1 = "both zero";
+..assert test2 = "x is zero";
+..assert test3 = "y is zero";
+..assert test4 = "neither zero";
+
+..out "Case expressions test completed"; 
\ No newline at end of file
diff --git a/js/scripting-lang/tests/08_first_class_functions.txt b/js/scripting-lang/tests/08_first_class_functions.txt
new file mode 100644
index 0000000..f228ccd
--- /dev/null
+++ b/js/scripting-lang/tests/08_first_class_functions.txt
@@ -0,0 +1,51 @@
+/* Unit Test: First-Class Functions */
+/* Tests: Function references, higher-order functions */
+
+/* Basic functions */
+double : x -> x * 2;
+square : x -> x * x;
+add1 : x -> x + 1;
+
+/* Function references */
+double_ref : @double;
+square_ref : @square;
+add1_ref : @add1;
+
+/* Test function references */
+result1 : double_ref 5;
+result2 : square_ref 3;
+result3 : add1_ref 10;
+
+..assert result1 = 10;
+..assert result2 = 9;
+..assert result3 = 11;
+
+/* Higher-order functions using standard library */
+composed : compose @double @square 3;
+piped : pipe @double @square 2;
+applied : apply @double 7;
+
+..assert composed = 18;
+..assert piped = 16;
+..assert applied = 14;
+
+/* Function references in case expressions */
+getFunction : type -> 
+  case type of
+    "double" : @double
+    "square" : @square
+    _        : @add1;
+
+func1 : getFunction "double";
+func2 : getFunction "square";
+func3 : getFunction "unknown";
+
+result4 : func1 4;
+result5 : func2 4;
+result6 : func3 4;
+
+..assert result4 = 8;
+..assert result5 = 16;
+..assert result6 = 5;
+
+..out "First-class functions test completed"; 
\ No newline at end of file
diff --git a/js/scripting-lang/tests/09_tables.txt b/js/scripting-lang/tests/09_tables.txt
new file mode 100644
index 0000000..3845903
--- /dev/null
+++ b/js/scripting-lang/tests/09_tables.txt
@@ -0,0 +1,50 @@
+/* Unit Test: Tables */
+/* Tests: Table literals, access, mixed types */
+
+/* Empty table */
+empty : {};
+
+/* Array-like table */
+numbers : {1, 2, 3, 4, 5};
+
+/* Key-value table */
+person : {name: "Alice", age: 30, active: true};
+
+/* Mixed table */
+mixed : {1, name: "Bob", 2, active: false};
+
+/* Test array access */
+first : numbers[1];
+second : numbers[2];
+last : numbers[5];
+
+..assert first = 1;
+..assert second = 2;
+..assert last = 5;
+
+/* Test object access */
+name : person.name;
+age : person.age;
+active : person.active;
+
+..assert name = "Alice";
+..assert age = 30;
+..assert active = true;
+
+/* Test mixed table access */
+first_mixed : mixed[1];
+name_mixed : mixed.name;
+second_mixed : mixed[2];
+
+..assert first_mixed = 1;
+..assert name_mixed = "Bob";
+..assert second_mixed = 2;
+
+/* Test bracket notation */
+name_bracket : person["name"];
+age_bracket : person["age"];
+
+..assert name_bracket = "Alice";
+..assert age_bracket = 30;
+
+..out "Tables test completed"; 
\ No newline at end of file
diff --git a/js/scripting-lang/tests/10_standard_library.txt b/js/scripting-lang/tests/10_standard_library.txt
new file mode 100644
index 0000000..e6f7160
--- /dev/null
+++ b/js/scripting-lang/tests/10_standard_library.txt
@@ -0,0 +1,49 @@
+/* Unit Test: Standard Library */
+/* Tests: All built-in higher-order functions */
+
+/* Basic functions for testing */
+double : x -> x * 2;
+square : x -> x * x;
+add : x y -> x + y;
+isPositive : x -> x > 0;
+
+/* Filter function - TESTING FAILING CASE */
+filtered1 : filter @isPositive 5;
+filtered2 : filter @isPositive -3;
+
+..out "filtered1 = ";
+..out filtered1;
+..out "filtered2 = ";
+..out filtered2;
+
+/* Map function */
+mapped1 : map @double 5;
+mapped2 : map @square 3;
+
+..assert mapped1 = 10;
+..assert mapped2 = 9;
+
+/* Compose function */
+composed : compose @double @square 3;
+..assert composed = 18;
+
+/* Pipe function */
+piped : pipe @double @square 2;
+..assert piped = 16;
+
+/* Apply function */
+applied : apply @double 7;
+..assert applied = 14;
+
+/* Reduce and Fold functions */
+reduced : reduce @add 0 5;
+folded : fold @add 0 5;
+
+..assert reduced = 5;
+..assert folded = 5;
+
+/* Curry function */
+curried : curry @add 3 4;
+..assert curried = 7;
+
+..out "Standard library test completed"; 
\ No newline at end of file
diff --git a/js/scripting-lang/tests/11_edge_cases.txt b/js/scripting-lang/tests/11_edge_cases.txt
new file mode 100644
index 0000000..ceb39b4
--- /dev/null
+++ b/js/scripting-lang/tests/11_edge_cases.txt
@@ -0,0 +1,50 @@
+/* Unit Test: Edge Cases and Error Conditions */
+/* Tests: Unary minus, complex expressions */
+
+/* Test unary minus operations */
+negative1 : -5;
+negative2 : -3.14;
+negative3 : -0;
+
+..assert negative1 = -5;
+..assert negative2 = -3.14;
+..assert negative3 = 0;
+
+/* Test complex unary minus expressions */
+complex_negative1 : -(-5);
+complex_negative2 : -(-(-3));
+complex_negative3 : -5 + 3;
+
+..assert complex_negative1 = 5;
+..assert complex_negative2 = -3;
+..assert complex_negative3 = -2;
+
+/* Test unary minus in function calls */
+abs : x -> case x of
+    x < 0 : -x
+    _ : x;
+
+abs1 : abs -5;
+abs2 : abs 5;
+
+..assert abs1 = 5;
+..assert abs2 = 5;
+
+/* Test complex nested expressions */
+nested1 : (1 + 2) * (3 - 4);
+nested2 : ((5 + 3) * 2) - 1;
+nested3 : -((2 + 3) * 4);
+
+..assert nested1 = -3;
+..assert nested2 = 15;
+..assert nested3 = -20;
+
+/* Test unary minus with function references */
+negate : x -> -x;
+negated1 : negate 5;
+negated2 : negate -3;
+
+..assert negated1 = -5;
+..assert negated2 = 3;
+
+..out "Edge cases test completed"; 
\ No newline at end of file
diff --git a/js/scripting-lang/tests/12_advanced_tables.txt b/js/scripting-lang/tests/12_advanced_tables.txt
new file mode 100644
index 0000000..3b2a326
--- /dev/null
+++ b/js/scripting-lang/tests/12_advanced_tables.txt
@@ -0,0 +1,85 @@
+/* Unit Test: Advanced Table Features */
+/* Tests: Nested tables, mixed types, array-like entries */
+
+/* Nested tables */
+nested_table : {
+    outer: {
+        inner: {
+            value: 42
+        }
+    }
+};
+
+/* Test nested access */
+nested_value1 : nested_table.outer.inner.value;
+..assert nested_value1 = 42;
+
+/* Tables with mixed types */
+mixed_advanced : {
+    1: "first",
+    name: "test",
+    nested: {
+        value: 100
+    }
+};
+
+/* Test mixed access */
+first : mixed_advanced[1];
+name : mixed_advanced.name;
+nested_value2 : mixed_advanced.nested.value;
+
+..assert first = "first";
+..assert name = "test";
+..assert nested_value2 = 100;
+
+/* Tables with boolean keys */
+bool_table : {
+    true: "yes",
+    false: "no"
+};
+
+/* Test boolean key access */
+yes : bool_table[true];
+no : bool_table[false];
+
+..assert yes = "yes";
+..assert no = "no";
+
+/* Tables with array-like entries and key-value pairs */
+comma_table : {
+    1, 2, 3,
+    key: "value",
+    4, 5
+};
+
+/* Test comma table access */
+first_comma : comma_table[1];
+second_comma : comma_table[2];
+key_comma : comma_table.key;
+fourth_comma : comma_table[4];
+
+..assert first_comma = 1;
+..assert second_comma = 2;
+..assert key_comma = "value";
+..assert fourth_comma = 4;
+
+/* Tables with numeric and string keys */
+mixed_keys : {
+    1: "one",
+    two: 2,
+    3: "three",
+    four: 4
+};
+
+/* Test mixed key access */
+one : mixed_keys[1];
+two : mixed_keys.two;
+three : mixed_keys[3];
+four : mixed_keys.four;
+
+..assert one = "one";
+..assert two = 2;
+..assert three = "three";
+..assert four = 4;
+
+..out "Advanced tables test completed"; 
\ No newline at end of file
diff --git a/js/scripting-lang/tests/13_standard_library_complete.txt b/js/scripting-lang/tests/13_standard_library_complete.txt
new file mode 100644
index 0000000..ed7749a
--- /dev/null
+++ b/js/scripting-lang/tests/13_standard_library_complete.txt
@@ -0,0 +1,97 @@
+/* Unit Test: Complete Standard Library */
+/* Tests: All built-in higher-order functions including reduce, fold, curry */
+
+/* Basic functions for testing */
+double : x -> x * 2;
+square : x -> x * x;
+add : x y -> x + y;
+isPositive : x -> x > 0;
+isEven : x -> x % 2 = 0;
+
+/* Map function */
+mapped1 : map @double 5;
+mapped2 : map @square 3;
+
+..assert mapped1 = 10;
+..assert mapped2 = 9;
+
+/* Compose function */
+composed : compose @double @square 3;
+..assert composed = 18;
+
+/* Pipe function */
+piped : pipe @double @square 2;
+..assert piped = 16;
+
+/* Apply function */
+applied : apply @double 7;
+..assert applied = 14;
+
+/* Filter function */
+filtered1 : filter @isPositive 5;
+filtered2 : filter @isPositive -3;
+
+..assert filtered1 = 5;
+..assert filtered2 = 0;
+
+/* Reduce function */
+reduced : reduce @add 0 5;
+..assert reduced = 5;
+
+/* Fold function */
+folded : fold @add 0 5;
+..assert folded = 5;
+
+/* Curry function */
+curried : curry @add 3 4;
+..assert curried = 7;
+
+/* Test partial application */
+compose_partial : compose @double @square;
+compose_result : compose_partial 3;
+..assert compose_result = 18;
+
+pipe_partial : pipe @double @square;
+pipe_result : pipe_partial 2;
+..assert pipe_result = 16;
+
+/* Test with negative numbers */
+negate : x -> -x;
+negative_compose : compose @double @negate 5;
+negative_pipe : pipe @negate @double 5;
+
+..assert negative_compose = -10;
+..assert negative_pipe = -10;
+
+/* Test with complex functions */
+complex_func : x -> x * x + 1;
+complex_compose : compose @double @complex_func 3;
+complex_pipe : pipe @complex_func @double 3;
+
+..assert complex_compose = 20;
+..assert complex_pipe = 20;
+
+/* Test filter with complex predicates */
+isLarge : x -> x > 10;
+filtered_large : filter @isLarge 15;
+filtered_small : filter @isLarge 5;
+
+..assert filtered_large = 15;
+..assert filtered_small = 0;
+
+/* Test reduce with different initial values */
+multiply : x y -> x * y;
+reduced_sum : reduce @add 10 5;
+reduced_mult : reduce @multiply 1 5;
+
+..assert reduced_sum = 15;
+..assert reduced_mult = 5;
+
+/* Test fold with different initial values */
+folded_sum : fold @add 10 5;
+folded_mult : fold @multiply 1 5;
+
+..assert folded_sum = 15;
+..assert folded_mult = 5;
+
+..out "Complete standard library test completed"; 
\ No newline at end of file
diff --git a/js/scripting-lang/tests/14_error_handling.txt b/js/scripting-lang/tests/14_error_handling.txt
new file mode 100644
index 0000000..ce485f7
--- /dev/null
+++ b/js/scripting-lang/tests/14_error_handling.txt
@@ -0,0 +1,65 @@
+/* Unit Test: Error Handling and Edge Cases */
+/* Tests: Error detection and handling */
+
+/* Test valid operations first to ensure basic functionality */
+valid_test : 5 + 3;
+..assert valid_test = 8;
+
+/* Test division by zero handling */
+/* This should be handled gracefully */
+safe_div : x y -> case y of
+    0 : "division by zero"
+    _ : x / y;
+
+div_result1 : safe_div 10 2;
+div_result2 : safe_div 10 0;
+
+..assert div_result1 = 5;
+..assert div_result2 = "division by zero";
+
+/* Test edge cases with proper handling */
+edge_case1 : case 0 of
+    0 : "zero"
+    _ : "other";
+
+edge_case2 : case "" of
+    "" : "empty string"
+    _ : "other";
+
+edge_case3 : case false of
+    false : "false"
+    _ : "other";
+
+..assert edge_case1 = "zero";
+..assert edge_case2 = "empty string";
+..assert edge_case3 = "false";
+
+/* Test complex error scenarios */
+complex_error_handling : input -> case input of
+    input < 0 : "negative"
+    input = 0 : "zero"
+    input > 100 : "too large"
+    _ : "valid";
+
+complex_result1 : complex_error_handling -5;
+complex_result2 : complex_error_handling 0;
+complex_result3 : complex_error_handling 150;
+complex_result4 : complex_error_handling 50;
+
+..assert complex_result1 = "negative";
+..assert complex_result2 = "zero";
+..assert complex_result3 = "too large";
+..assert complex_result4 = "valid";
+
+/* Test safe arithmetic operations */
+safe_add : x y -> case y of
+    0 : x
+    _ : x + y;
+
+safe_result1 : safe_add 5 3;
+safe_result2 : safe_add 5 0;
+
+..assert safe_result1 = 8;
+..assert safe_result2 = 5;
+
+..out "Error handling test completed successfully"; 
\ No newline at end of file
diff --git a/js/scripting-lang/tests/15_performance_stress.txt b/js/scripting-lang/tests/15_performance_stress.txt
new file mode 100644
index 0000000..7dab1f5
--- /dev/null
+++ b/js/scripting-lang/tests/15_performance_stress.txt
@@ -0,0 +1,131 @@
+/* Unit Test: Performance and Stress Testing */
+/* 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;
+
+..assert large_sum = 15;
+
+/* Test nested function calls */
+nested_func1 : x -> x + 1;
+nested_func2 : x -> nested_func1 x;
+nested_func3 : x -> nested_func2 x;
+nested_func4 : x -> nested_func3 x;
+nested_func5 : x -> nested_func4 x;
+
+deep_nested : nested_func5 10;
+..assert deep_nested = 15;
+
+/* Test complex mathematical expressions */
+complex_math1 : (1 + 2) * (3 + 4) - (5 + 6);
+complex_math2 : ((2 ^ 3) + (4 * 5)) / (6 - 2);
+complex_math3 : -((1 + 2 + 3) * (4 + 5 + 6));
+
+..assert complex_math1 = 10;
+..assert complex_math2 = 7;
+..assert complex_math3 = -126;
+
+/* 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"};
+
+table_size : 8;
+..assert table_size = 8;
+
+/* Test recursive-like patterns with functions */
+accumulate : n -> case n of
+    0 : 0
+    _ : 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;
+case_test2 : complex_case 0;
+case_test3 : complex_case 5;
+case_test4 : complex_case 50;
+case_test5 : complex_case 500;
+case_test6 : complex_case 5000;
+
+..assert case_test1 = "negative";
+..assert case_test2 = "zero";
+..assert case_test3 = "small";
+..assert case_test4 = "medium";
+..assert case_test5 = "large";
+..assert case_test6 = "huge";
+
+/* Test standard library with complex operations */
+double : x -> x * 2;
+square : x -> x * x;
+add : x y -> x + y;
+
+complex_std1 : compose @double @square 3;
+complex_std2 : pipe @square @double 4;
+complex_std3 : apply @add 5 3;
+
+..assert complex_std1 = 18;
+..assert complex_std2 = 32;
+..assert complex_std3 = 8;
+
+/* Test table with computed keys and nested structures */
+computed_table : {
+    (1 + 1): "two",
+    (2 * 3): "six",
+    (10 - 5): "five",
+    nested: {
+        (2 + 2): "four",
+        deep: {
+            (3 * 3): "nine"
+        }
+    }
+};
+
+computed_test1 : computed_table[2];
+computed_test2 : computed_table[6];
+computed_test3 : computed_table[5];
+computed_test4 : computed_table.nested[4];
+computed_test5 : computed_table.nested.deep[9];
+
+..assert computed_test1 = "two";
+..assert computed_test2 = "six";
+..assert computed_test3 = "five";
+..assert computed_test4 = "four";
+..assert computed_test5 = "nine";
+
+/* Test logical operations with complex expressions */
+complex_logic1 : (5 > 3) and (10 < 20) and (2 + 2 = 4);
+complex_logic2 : (1 > 5) or (10 = 10) or (3 < 2);
+complex_logic3 : not ((5 > 3) and (10 < 5));
+
+..assert complex_logic1 = true;
+..assert complex_logic2 = true;
+..assert complex_logic3 = true;
+
+/* Test function composition with multiple functions */
+f1 : x -> x + 1;
+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;
+
+..assert composed1 = 10;
+..assert composed2 = 10;
+
+..out "Performance and stress test completed successfully"; 
\ No newline at end of file
diff --git a/js/scripting-lang/tests/16_advanced_functional.txt b/js/scripting-lang/tests/16_advanced_functional.txt
new file mode 100644
index 0000000..3da9d76
--- /dev/null
+++ b/js/scripting-lang/tests/16_advanced_functional.txt
@@ -0,0 +1,169 @@
+/* Unit Test: Advanced Functional Programming Patterns */
+/* Tests: Higher-order functions, currying, partial application, monadic patterns */
+
+/* Test function composition with multiple functions */
+id : x -> x;
+const : x y -> x;
+flip : f x y -> f y x;
+
+/* Test identity function */
+id_test : id 42;
+..assert id_test = 42;
+
+/* Test constant function */
+const_test : const 5 10;
+..assert const_test = 5;
+
+/* Test function flipping */
+sub : x y -> x - y;
+flipped_sub : flip @sub;
+flipped_result : flipped_sub 5 10;
+..assert flipped_result = 5;
+
+/* Test partial application patterns */
+partial1 : f x -> y -> f x y;
+partial2 : f x y -> f x y;
+
+add : x y -> x + y;
+add5 : partial1 @add 5;
+add5_result : add5 3;
+..assert add5_result = 8;
+
+/* Test function composition with multiple arguments */
+compose2 : f g x y -> f (g x y);
+compose3 : f g h x -> f (g (h x));
+
+double : x -> x * 2;
+square : x -> x * x;
+increment : x -> x + 1;
+
+composed1 : compose2 @double @add 3 4;
+composed2 : compose3 @double @square @increment 2;
+..assert composed1 = 14;
+..assert composed2 = 18;
+
+/* Test monadic-like patterns with Maybe simulation */
+maybe : x -> case x of
+    undefined : "Nothing"
+    null : "Nothing"
+    _ : "Just " + x;
+
+maybe_map : f m -> case m of
+    "Nothing" : "Nothing"
+    _ : f m;
+
+maybe_bind : m f -> case m of
+    "Nothing" : "Nothing"
+    _ : f m;
+
+maybe_test1 : maybe undefined;
+maybe_test2 : maybe 42;
+maybe_test3 : maybe_map @double "Just 5";
+maybe_test4 : maybe_bind "Just 3" @double;
+
+..assert maybe_test1 = "Nothing";
+..assert maybe_test2 = "Just 42";
+..assert maybe_test3 = "Just 10";
+..assert maybe_test4 = "Just 6";
+
+/* Test list-like operations with tables */
+list_map : f table -> {
+    f table[1],
+    f table[2],
+    f table[3]
+};
+
+list_filter : p table -> case p table[1] of
+    true : {table[1]}
+    false : {};
+
+list_reduce : f init table -> case table[1] of
+    undefined : init
+    _ : f init table[1];
+
+test_list : {1, 2, 3};
+mapped_list : list_map @double test_list;
+filtered_list : list_filter (x -> x > 1) test_list;
+reduced_list : list_reduce @add 0 test_list;
+
+..assert mapped_list[1] = 2;
+..assert mapped_list[2] = 4;
+..assert mapped_list[3] = 6;
+..assert filtered_list[1] = 2;
+..assert reduced_list = 1;
+
+/* Test point-free style programming */
+pointfree_add : add;
+pointfree_double : double;
+pointfree_compose : compose @pointfree_double @pointfree_add;
+
+pointfree_result : pointfree_compose 5 3;
+..assert pointfree_result = 16;
+
+/* Test function memoization pattern */
+memoize : f -> {
+    cache: {},
+    call: x -> case cache[x] of
+        undefined : cache[x] = f x
+        _ : cache[x]
+};
+
+expensive_func : x -> x * x + x + 1;
+memoized_func : memoize @expensive_func;
+
+memo_result1 : memoized_func.call 5;
+memo_result2 : memoized_func.call 5; /* Should use cache */
+..assert memo_result1 = 31;
+..assert memo_result2 = 31;
+
+/* Test continuation-passing style (CPS) */
+cps_add : x y k -> k (x + y);
+cps_multiply : x y k -> k (x * y);
+cps_square : x k -> k (x * x);
+
+cps_example : cps_add 3 4 (sum -> 
+    cps_multiply sum 2 (product -> 
+        cps_square product (result -> result)
+    )
+);
+..assert cps_example = 98;
+
+/* Test trampoline pattern for tail recursion simulation */
+trampoline : f -> case f of
+    f is function : trampoline (f)
+    _ : f;
+
+bounce : n -> case n of
+    0 : 0
+    _ : n + (n - 1);
+
+trampoline_result : trampoline @bounce 5;
+..assert trampoline_result = 15;
+
+/* Test applicative functor pattern */
+applicative : f x -> case f of
+    f is function : f x
+    _ : x;
+
+applicative_test : applicative @double 5;
+..assert applicative_test = 10;
+
+/* Test function pipelines */
+pipeline : x f1 f2 f3 -> f3 (f2 (f1 x));
+pipeline_result : pipeline 2 @increment @double @square;
+..assert pipeline_result = 36;
+
+/* Test function combinators */
+S : f g x -> f x (g x);
+K : x y -> x;
+I : x -> x;
+
+S_test : S @add @double 3;
+K_test : K 5 10;
+I_test : I 42;
+
+..assert S_test = 9;
+..assert K_test = 5;
+..assert I_test = 42;
+
+..out "Advanced functional programming test completed successfully"; 
\ No newline at end of file
diff --git a/js/scripting-lang/tests/17_real_world_scenarios.txt b/js/scripting-lang/tests/17_real_world_scenarios.txt
new file mode 100644
index 0000000..0a9fc49
--- /dev/null
+++ b/js/scripting-lang/tests/17_real_world_scenarios.txt
@@ -0,0 +1,219 @@
+/* Unit Test: Real-World Programming Scenarios */
+/* Tests: Practical use cases, data processing, business logic */
+
+/* Scenario 1: User Management System */
+/* Define user types and validation */
+isValidEmail : email -> case email of
+    email contains "@" : true
+    _ : false;
+
+isValidAge : age -> case age of
+    age >= 0 and age <= 120 : true
+    _ : false;
+
+createUser : name email age -> case (isValidEmail email) and (isValidAge age) of
+    true : {
+        name: name,
+        email: email,
+        age: age,
+        status: "active"
+    }
+    false : "invalid user data";
+
+user1 : createUser "Alice" "alice@example.com" 25;
+user2 : createUser "Bob" "invalid-email" 30;
+user3 : createUser "Charlie" "charlie@test.com" 150;
+
+..assert user1.name = "Alice";
+..assert user2 = "invalid user data";
+..assert user3 = "invalid user data";
+
+/* Scenario 2: Shopping Cart System */
+/* Product definitions */
+product1 : {id: 1, name: "Laptop", price: 999.99, category: "electronics"};
+product2 : {id: 2, name: "Book", price: 19.99, category: "books"};
+product3 : {id: 3, name: "Coffee", price: 4.99, category: "food"};
+
+/* Cart operations */
+addToCart : cart product -> {
+    cart,
+    product
+};
+
+calculateTotal : cart -> case cart of
+    cart is table : cart.product.price
+    _ : 0;
+
+applyDiscount : total discount -> case discount of
+    discount > 0 and discount <= 100 : total * (1 - discount / 100)
+    _ : total;
+
+cart : addToCart {} product1;
+cart : addToCart cart product2;
+total : calculateTotal cart;
+discounted : applyDiscount total 10;
+
+..assert total = 1019.98;
+..assert discounted = 917.982;
+
+/* Scenario 3: Data Processing Pipeline */
+/* Sample data */
+sales_data : {
+    {month: "Jan", sales: 1000, region: "North"},
+    {month: "Feb", sales: 1200, region: "North"},
+    {month: "Mar", sales: 800, region: "South"},
+    {month: "Apr", sales: 1500, region: "North"},
+    {month: "May", sales: 900, region: "South"}
+};
+
+/* Data processing functions */
+filterByRegion : data region -> case data of
+    data.region = region : data
+    _ : null;
+
+sumSales : data -> case data of
+    data is table : data.sales
+    _ : 0;
+
+calculateAverage : total count -> case count of
+    count > 0 : total / count
+    _ : 0;
+
+/* Process North region sales */
+north_sales : filterByRegion sales_data "North";
+north_total : sumSales north_sales;
+north_avg : calculateAverage north_total 3;
+
+..assert north_total = 3700;
+..assert north_avg = 1233.3333333333333;
+
+/* Scenario 4: Configuration Management */
+/* Environment configuration */
+getConfig : env -> case env of
+    "development" : {
+        database: "dev_db",
+        port: 3000,
+        debug: true,
+        log_level: "debug"
+    }
+    "production" : {
+        database: "prod_db",
+        port: 80,
+        debug: false,
+        log_level: "error"
+    }
+    "testing" : {
+        database: "test_db",
+        port: 3001,
+        debug: true,
+        log_level: "info"
+    }
+    _ : "unknown environment";
+
+dev_config : getConfig "development";
+prod_config : getConfig "production";
+
+..assert dev_config.debug = true;
+..assert prod_config.debug = false;
+..assert dev_config.port = 3000;
+..assert prod_config.port = 80;
+
+/* Scenario 5: Error Handling and Recovery */
+/* Robust function with error handling */
+safeDivide : x y -> case y of
+    0 : "division by zero error"
+    _ : x / y;
+
+safeParseNumber : str -> case str of
+    str is number : str
+    _ : "invalid number";
+
+processData : data -> case data of
+    data is number : data * 2
+    data is string : safeParseNumber data
+    _ : "unsupported data type";
+
+safe_result1 : safeDivide 10 2;
+safe_result2 : safeDivide 10 0;
+safe_result3 : processData 5;
+safe_result4 : processData "abc";
+
+..assert safe_result1 = 5;
+..assert safe_result2 = "division by zero error";
+..assert safe_result3 = 10;
+..assert safe_result4 = "invalid number";
+
+/* Scenario 6: Event Handling System */
+/* Event types and handlers */
+eventHandlers : {
+    "user.login": x -> "User logged in: " + x,
+    "user.logout": x -> "User logged out: " + x,
+    "order.created": x -> "Order created: " + x,
+    "order.completed": x -> "Order completed: " + x
+};
+
+handleEvent : event data -> case eventHandlers[event] of
+    handler : handler data
+    _ : "Unknown event: " + event;
+
+login_event : handleEvent "user.login" "alice@example.com";
+logout_event : handleEvent "user.logout" "bob@example.com";
+unknown_event : handleEvent "unknown.event" "data";
+
+..assert login_event = "User logged in: alice@example.com";
+..assert logout_event = "User logged out: bob@example.com";
+..assert unknown_event = "Unknown event: unknown.event";
+
+/* Scenario 7: Caching System */
+/* Simple cache implementation */
+cache : {};
+
+setCache : key value -> cache[key] = value;
+getCache : key -> case cache[key] of
+    undefined : "not found"
+    value : value;
+clearCache : key -> cache[key] = undefined;
+
+setCache "user.1" "Alice";
+setCache "user.2" "Bob";
+cache_result1 : getCache "user.1";
+cache_result2 : getCache "user.999";
+clearCache "user.1";
+cache_result3 : getCache "user.1";
+
+..assert cache_result1 = "Alice";
+..assert cache_result2 = "not found";
+..assert cache_result3 = "not found";
+
+/* Scenario 8: API Response Processing */
+/* Mock API responses */
+apiResponse : {
+    status: 200,
+    data: {
+        users: {
+            {id: 1, name: "Alice", active: true},
+            {id: 2, name: "Bob", active: false},
+            {id: 3, name: "Charlie", active: true}
+        },
+        total: 3
+    }
+};
+
+processApiResponse : response -> case response.status of
+    200 : response.data
+    404 : "not found"
+    500 : "server error"
+    _ : "unknown status";
+
+getActiveUsers : data -> case data.users of
+    users : case users.active of
+        true : users
+        _ : null;
+
+api_data : processApiResponse apiResponse;
+active_users : getActiveUsers api_data;
+
+..assert api_data.total = 3;
+..assert active_users = null; /* Simplified for this example */
+
+..out "Real-world scenarios test completed successfully"; 
\ No newline at end of file
diff --git a/js/scripting-lang/tests/integration_01_basic_features.txt b/js/scripting-lang/tests/integration_01_basic_features.txt
new file mode 100644
index 0000000..cb215ab
--- /dev/null
+++ b/js/scripting-lang/tests/integration_01_basic_features.txt
@@ -0,0 +1,37 @@
+/* Integration Test: Basic Language Features */
+/* Combines: arithmetic, comparisons, functions, IO */
+
+..out "=== Integration Test: Basic Features ===";
+
+/* Define utility functions */
+add : x y -> x + y;
+multiply : x y -> x * y;
+isEven : x -> x % 2 = 0;
+isPositive : x -> x > 0;
+
+/* Test arithmetic with functions */
+sum : add 10 5;
+product : multiply 4 6;
+doubled : multiply 2 sum;
+
+..assert sum = 15;
+..assert product = 24;
+..assert doubled = 30;
+
+/* Test comparisons with functions */
+even_test : isEven 8;
+odd_test : isEven 7;
+positive_test : isPositive 5;
+negative_test : isPositive -3;
+
+..assert even_test = true;
+..assert odd_test = false;
+..assert positive_test = true;
+..assert negative_test = false;
+
+/* Test complex expressions */
+complex : add (multiply 3 4) (isEven 10 and isPositive 5);
+
+..assert complex = 13;
+
+..out "Basic features integration test completed"; 
\ No newline at end of file
diff --git a/js/scripting-lang/tests/integration_02_pattern_matching.txt b/js/scripting-lang/tests/integration_02_pattern_matching.txt
new file mode 100644
index 0000000..f0b969a
--- /dev/null
+++ b/js/scripting-lang/tests/integration_02_pattern_matching.txt
@@ -0,0 +1,64 @@
+/* Integration Test: Pattern Matching */
+/* Combines: case expressions, functions, recursion, complex patterns */
+
+..out "=== Integration Test: Pattern Matching ===";
+
+/* Recursive factorial with case expressions */
+factorial : n -> 
+  case n of
+    0 : 1
+    _ : n * (factorial (n - 1));
+
+/* Pattern matching with multiple parameters */
+classify : x y -> 
+  case x y of
+    0 0 : "both zero"
+    0 _ : "x is zero"
+    _ 0 : "y is zero"
+    _ _ : case x of
+            0 : "x is zero (nested)"
+            _ : case y of
+                  0 : "y is zero (nested)"
+                  _ : "neither zero";
+
+/* Test factorial */
+fact5 : factorial 5;
+fact3 : factorial 3;
+
+..assert fact5 = 120;
+..assert fact3 = 6;
+
+/* Test classification */
+test1 : classify 0 0;
+test2 : classify 0 5;
+test3 : classify 5 0;
+test4 : classify 5 5;
+
+..assert test1 = "both zero";
+..assert test2 = "x is zero";
+..assert test3 = "y is zero";
+..assert test4 = "neither zero";
+
+/* Complex nested case expressions */
+analyze : x y z -> 
+  case x y z of
+    0 0 0 : "all zero"
+    0 0 _ : "x and y zero"
+    0 _ 0 : "x and z zero"
+    _ 0 0 : "y and z zero"
+    0 _ _ : "only x zero"
+    _ 0 _ : "only y zero"
+    _ _ 0 : "only z zero"
+    _ _ _ : "none zero";
+
+result1 : analyze 0 0 0;
+result2 : analyze 0 1 1;
+result3 : analyze 1 0 1;
+result4 : analyze 1 1 1;
+
+..assert result1 = "all zero";
+..assert result2 = "only x zero";
+..assert result3 = "only y zero";
+..assert result4 = "none zero";
+
+..out "Pattern matching integration test completed"; 
\ No newline at end of file
diff --git a/js/scripting-lang/tests/integration_03_functional_programming.txt b/js/scripting-lang/tests/integration_03_functional_programming.txt
new file mode 100644
index 0000000..8af6760
--- /dev/null
+++ b/js/scripting-lang/tests/integration_03_functional_programming.txt
@@ -0,0 +1,68 @@
+/* Integration Test: Functional Programming */
+/* Combines: first-class functions, higher-order functions, composition */
+
+..out "=== Integration Test: Functional Programming ===";
+
+/* Basic functions */
+double : x -> x * 2;
+square : x -> x * x;
+add1 : x -> x + 1;
+identity : x -> x;
+isEven : x -> x % 2 = 0;
+
+/* Function composition */
+composed1 : compose @double @square 3;
+composed2 : compose @square @double 2;
+composed3 : compose @add1 @double 5;
+
+..assert composed1 = 18;
+..assert composed2 = 16;
+..assert composed3 = 11;
+
+/* Function piping */
+piped1 : pipe @double @square 3;
+piped2 : pipe @square @double 2;
+piped3 : pipe @add1 @double 5;
+
+..assert piped1 = 36;
+..assert piped2 = 8;
+..assert piped3 = 12;
+
+/* Function application */
+applied1 : apply @double 7;
+applied2 : apply @square 4;
+applied3 : apply @add1 10;
+
+..assert applied1 = 14;
+..assert applied2 = 16;
+..assert applied3 = 11;
+
+/* Function selection with case expressions */
+getOperation : type -> 
+  case type of
+    "double" : @double
+    "square" : @square
+    "add1"   : @add1
+    _        : @identity;
+
+/* Test function selection */
+op1 : getOperation "double";
+op2 : getOperation "square";
+op3 : getOperation "add1";
+op4 : getOperation "unknown";
+
+result1 : op1 5;
+result2 : op2 4;
+result3 : op3 7;
+result4 : op4 3;
+
+..assert result1 = 10;
+..assert result2 = 16;
+..assert result3 = 8;
+..assert result4 = 3;
+
+/* Complex functional composition */
+complex : compose @double (compose @square @add1) 3;
+..assert complex = 32;
+
+..out "Functional programming integration test completed"; 
\ No newline at end of file
diff --git a/js/scripting-lang/tests/integration_04_mini_case_multi_param.txt b/js/scripting-lang/tests/integration_04_mini_case_multi_param.txt
new file mode 100644
index 0000000..be4b71d
--- /dev/null
+++ b/js/scripting-lang/tests/integration_04_mini_case_multi_param.txt
@@ -0,0 +1,17 @@
+/* Multi-parameter case expression at top level */
+x : 1;
+y : 2;
+result1 : case x y of
+    1 2 : "matched"
+    _ _ : "not matched";
+
+/* Multi-parameter case expression inside a function */
+f : a b -> case a b of
+    1 2 : "matched"
+    _ _ : "not matched";
+result2 : f 1 2;
+result3 : f 3 4;
+
+..out result1;
+..out result2;
+..out result3; 
\ No newline at end of file