diff options
Diffstat (limited to 'js/scripting-lang/tests/13_standard_library_complete.txt')
-rw-r--r-- | js/scripting-lang/tests/13_standard_library_complete.txt | 46 |
1 files changed, 23 insertions, 23 deletions
diff --git a/js/scripting-lang/tests/13_standard_library_complete.txt b/js/scripting-lang/tests/13_standard_library_complete.txt index ed7749a..c73396a 100644 --- a/js/scripting-lang/tests/13_standard_library_complete.txt +++ b/js/scripting-lang/tests/13_standard_library_complete.txt @@ -2,29 +2,29 @@ /* 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; +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 5; -mapped2 : map @square 3; +mapped1 : map @double_func 5; +mapped2 : map @square_func 3; ..assert mapped1 = 10; ..assert mapped2 = 9; /* Compose function */ -composed : compose @double @square 3; +composed : compose @double_func @square_func 3; ..assert composed = 18; /* Pipe function */ -piped : pipe @double @square 2; +piped : pipe @double_func @square_func 2; ..assert piped = 16; /* Apply function */ -applied : apply @double 7; +applied : apply @double_func 7; ..assert applied = 14; /* Filter function */ @@ -35,38 +35,38 @@ filtered2 : filter @isPositive -3; ..assert filtered2 = 0; /* Reduce function */ -reduced : reduce @add 0 5; +reduced : reduce @add_func 0 5; ..assert reduced = 5; /* Fold function */ -folded : fold @add 0 5; +folded : fold @add_func 0 5; ..assert folded = 5; /* Curry function */ -curried : curry @add 3 4; +curried : curry @add_func 3 4; ..assert curried = 7; /* Test partial application */ -compose_partial : compose @double @square; +compose_partial : compose @double_func @square_func; compose_result : compose_partial 3; ..assert compose_result = 18; -pipe_partial : pipe @double @square; +pipe_partial : pipe @double_func @square_func; 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; +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 @complex_func 3; -complex_pipe : pipe @complex_func @double 3; +complex_compose : compose @double_func @complex_func 3; +complex_pipe : pipe @complex_func @double_func 3; ..assert complex_compose = 20; ..assert complex_pipe = 20; @@ -80,16 +80,16 @@ filtered_small : filter @isLarge 5; ..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; +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 10 5; -folded_mult : fold @multiply 1 5; +folded_sum : fold @add_func 10 5; +folded_mult : fold @multiply_func 1 5; ..assert folded_sum = 15; ..assert folded_mult = 5; |