diff options
Diffstat (limited to 'js/scripting-lang/baba-yaga-c/tests/15_performance_stress.txt')
-rw-r--r-- | js/scripting-lang/baba-yaga-c/tests/15_performance_stress.txt | 131 |
1 files changed, 0 insertions, 131 deletions
diff --git a/js/scripting-lang/baba-yaga-c/tests/15_performance_stress.txt b/js/scripting-lang/baba-yaga-c/tests/15_performance_stress.txt deleted file mode 100644 index 4ea961b..0000000 --- a/js/scripting-lang/baba-yaga-c/tests/15_performance_stress.txt +++ /dev/null @@ -1,131 +0,0 @@ -/* Unit Test: Performance and Stress Testing */ -/* Tests: Large computations, nested functions, complex expressions */ - -/* Test large arithmetic computations */ -sum1 : 0 + 1; -sum2 : sum1 + 2; -sum3 : sum2 + 3; -sum4 : sum3 + 4; -large_sum : sum4 + 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 = 11; - -/* 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 = -90; - -/* Test large table operations */ -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 -> 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 -> 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; -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; -myAdd : x y -> x + y; - -complex_std1 : compose @double @square 3; -complex_std2 : pipe @square @double 4; -complex_std3 : curry @myAdd 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; - -/* 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; - -..out "Performance and stress test completed successfully"; \ No newline at end of file |