diff options
Diffstat (limited to 'js/scripting-lang/baba-yaga-c/tests/integration_03_functional_programming.txt')
-rw-r--r-- | js/scripting-lang/baba-yaga-c/tests/integration_03_functional_programming.txt | 68 |
1 files changed, 0 insertions, 68 deletions
diff --git a/js/scripting-lang/baba-yaga-c/tests/integration_03_functional_programming.txt b/js/scripting-lang/baba-yaga-c/tests/integration_03_functional_programming.txt deleted file mode 100644 index a0e3668..0000000 --- a/js/scripting-lang/baba-yaga-c/tests/integration_03_functional_programming.txt +++ /dev/null @@ -1,68 +0,0 @@ -/* Integration Test: Functional Programming */ -/* Combines: first-class functions, higher-order functions, composition */ - -..out "=== Integration Test: Functional Programming ==="; - -/* Basic functions */ -double_func : x -> x * 2; -square_func : x -> x * x; -add1 : x -> x + 1; -identity_func : x -> x; -isEven : x -> x % 2 = 0; - -/* Function composition */ -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_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_func 7; -applied2 : apply @square_func 4; -applied3 : apply @add1 10; - -..assert applied1 = 14; -..assert applied2 = 16; -..assert applied3 = 11; - -/* Function selection with case expressions */ -getOperation : type -> - when type is - "double" then @double_func - "square" then @square_func - "add1" then @add1 - _ then @identity_func; - -/* 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_func (compose @square_func @add1) 3; -..assert complex = 32; - -..out "Functional programming integration test completed"; \ No newline at end of file |