diff options
Diffstat (limited to 'js/scripting-lang/tests/integration_03_functional_programming.txt')
-rw-r--r-- | js/scripting-lang/tests/integration_03_functional_programming.txt | 30 |
1 files changed, 15 insertions, 15 deletions
diff --git a/js/scripting-lang/tests/integration_03_functional_programming.txt b/js/scripting-lang/tests/integration_03_functional_programming.txt index 1d4671e..a0e3668 100644 --- a/js/scripting-lang/tests/integration_03_functional_programming.txt +++ b/js/scripting-lang/tests/integration_03_functional_programming.txt @@ -4,33 +4,33 @@ ..out "=== Integration Test: Functional Programming ==="; /* Basic functions */ -double : x -> x * 2; -square : x -> x * x; +double_func : x -> x * 2; +square_func : x -> x * x; add1 : x -> x + 1; -identity : x -> x; +identity_func : x -> x; isEven : x -> x % 2 = 0; /* Function composition */ -composed1 : compose @double @square 3; -composed2 : compose @square @double 2; -composed3 : compose @add1 @double 5; +composed1 : compose @double_func @square_func 3; +composed2 : compose @square_func @double_func 2; +composed3 : compose @add1 @double_func 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; +piped1 : pipe @double_func @square_func 3; +piped2 : pipe @square_func @double_func 2; +piped3 : pipe @add1 @double_func 5; ..assert piped1 = 36; ..assert piped2 = 8; ..assert piped3 = 12; /* Function application */ -applied1 : apply @double 7; -applied2 : apply @square 4; +applied1 : apply @double_func 7; +applied2 : apply @square_func 4; applied3 : apply @add1 10; ..assert applied1 = 14; @@ -40,10 +40,10 @@ applied3 : apply @add1 10; /* Function selection with case expressions */ getOperation : type -> when type is - "double" then @double - "square" then @square + "double" then @double_func + "square" then @square_func "add1" then @add1 - _ then @identity; + _ then @identity_func; /* Test function selection */ op1 : getOperation "double"; @@ -62,7 +62,7 @@ result4 : op4 3; ..assert result4 = 3; /* Complex functional composition */ -complex : compose @double (compose @square @add1) 3; +complex : compose @double_func (compose @square_func @add1) 3; ..assert complex = 32; ..out "Functional programming integration test completed"; \ No newline at end of file |