diff options
Diffstat (limited to 'js/scripting-lang/scratch_tests/test_nested_functions.txt')
-rw-r--r-- | js/scripting-lang/scratch_tests/test_nested_functions.txt | 28 |
1 files changed, 28 insertions, 0 deletions
diff --git a/js/scripting-lang/scratch_tests/test_nested_functions.txt b/js/scripting-lang/scratch_tests/test_nested_functions.txt new file mode 100644 index 0000000..539491b --- /dev/null +++ b/js/scripting-lang/scratch_tests/test_nested_functions.txt @@ -0,0 +1,28 @@ +/* Test nested table functions */ + +// Test nested tables with functions +nested : { + math: { + add: x y -> x + y, + subtract: x y -> x - y + }, + logic: { + logical_and: x y -> x and y, + logical_or: x y -> x or y + } +}; + +// Output tests +..out "=== NESTED FUNCTIONS TEST ==="; + +..out "Nested math functions:"; +nested_add : nested.math.add 100 200; +..out nested_add; +nested_sub : nested.math.subtract 50 30; +..out nested_sub; + +..out "Nested logic functions:"; +logic_and : nested.logic.logical_and true false; +..out logic_and; +logic_or : nested.logic.logical_or true false; +..out logic_or; \ No newline at end of file |