diff options
Diffstat (limited to 'js/scripting-lang/baba-yaga-c/tests/13_standard_library_complete.txt')
-rw-r--r-- | js/scripting-lang/baba-yaga-c/tests/13_standard_library_complete.txt | 97 |
1 files changed, 0 insertions, 97 deletions
diff --git a/js/scripting-lang/baba-yaga-c/tests/13_standard_library_complete.txt b/js/scripting-lang/baba-yaga-c/tests/13_standard_library_complete.txt deleted file mode 100644 index 451dc0a..0000000 --- a/js/scripting-lang/baba-yaga-c/tests/13_standard_library_complete.txt +++ /dev/null @@ -1,97 +0,0 @@ -/* Unit Test: Complete Standard Library */ -/* Tests: All built-in higher-order functions including reduce, fold, curry */ - -/* Basic functions for testing */ -double_func : x -> x * 2; -square_func : x -> x * x; -add_func : x y -> x + y; -isPositive : x -> x > 0; -isEven : x -> x % 2 = 0; - -/* Map function */ -mapped1 : map @double_func 5; -mapped2 : map @square_func 3; - -..assert mapped1 = 10; -..assert mapped2 = 9; - -/* Compose function */ -composed : compose @double_func @square_func 3; -..assert composed = 18; - -/* Pipe function */ -piped : pipe @double_func @square_func 2; -..assert piped = 16; - -/* Apply function */ -applied : apply @double_func 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_func 0 5; -..assert reduced = 5; - -/* Fold function */ -folded : fold @add_func 0 5; -..assert folded = 5; - -/* Curry function */ -curried : curry @add_func 3 4; -..assert curried = 7; - -/* Test partial application */ -compose_partial : compose @double_func @square_func; -compose_result : compose_partial 3; -..assert compose_result = 18; - -pipe_partial : pipe @double_func @square_func; -pipe_result : pipe_partial 2; -..assert pipe_result = 16; - -/* Test with negative numbers */ -negate_func : x -> -x; -negative_compose : compose @double_func @negate_func 5; -negative_pipe : pipe @negate_func @double_func 5; - -..assert negative_compose = -10; -..assert negative_pipe = -10; - -/* Test with complex functions */ -complex_func : x -> x * x + 1; -complex_compose : compose @double_func @complex_func 3; -complex_pipe : pipe @complex_func @double_func 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_func : x y -> x * y; -reduced_sum : reduce @add_func 10 5; -reduced_mult : reduce @multiply_func 1 5; - -..assert reduced_sum = 15; -..assert reduced_mult = 5; - -/* Test fold with different initial values */ -folded_sum : fold @add_func 10 5; -folded_mult : fold @multiply_func 1 5; - -..assert folded_sum = 15; -..assert folded_mult = 5; - -..out "Complete standard library test completed"; \ No newline at end of file |