diff options
Diffstat (limited to 'js/scripting-lang/table_edge_cases_test.txt')
-rw-r--r-- | js/scripting-lang/table_edge_cases_test.txt | 304 |
1 files changed, 0 insertions, 304 deletions
diff --git a/js/scripting-lang/table_edge_cases_test.txt b/js/scripting-lang/table_edge_cases_test.txt deleted file mode 100644 index 268f271..0000000 --- a/js/scripting-lang/table_edge_cases_test.txt +++ /dev/null @@ -1,304 +0,0 @@ -/* Table Edge Cases Tests */ - -/* Test 1: Nested tables */ -..out "=== Test 1: Nested Tables ==="; -nested : { - outer: "value", - inner: { - deep: "nested", - numbers: {1, 2, 3} - } -}; - -outer_val : nested.outer; -inner_table : nested.inner; -deep_val : nested.inner.deep; -inner_nums : nested.inner.numbers; -first_num : nested.inner.numbers[1]; - -..out "Outer: "; -..out outer_val; -..out "Inner table: "; -..out inner_table; -..out "Deep: "; -..out deep_val; -..out "Inner numbers: "; -..out inner_nums; -..out "First number: "; -..out first_num; - -/* Test 2: Tables with different value types */ -..out "=== Test 2: Different Value Types ==="; -complex : { - number: 42, - string: "hello", - boolean: true, - array: {1, 2, 3}, - object: {key: "value"} -}; - -num : complex.number; -str : complex.string; -bool : complex.boolean; -arr : complex.array; -obj : complex.object; - -..out "Number: "; -..out num; -..out "String: "; -..out str; -..out "Boolean: "; -..out bool; -..out "Array: "; -..out arr; -..out "Object: "; -..out obj; - -/* Test 3: Tables with function references */ -..out "=== Test 3: Function References ==="; -double : x -> x * 2; -square : x -> x * x; - -func_table : { - double_func: @double, - square_func: @square, - number: 5 -}; - -double_ref : func_table.double_func; -square_ref : func_table.square_func; -table_num : func_table.number; - -..out "Double ref: "; -..out double_ref; -..out "Square ref: "; -..out square_ref; -..out "Table number: "; -..out table_num; - -/* Test 4: Tables with arithmetic expressions */ -..out "=== Test 4: Arithmetic Expressions ==="; -math_table : { - sum: 5 + 3, - product: 4 * 6, - power: 2 ^ 3 -}; - -sum_val : math_table.sum; -prod_val : math_table.product; -pow_val : math_table.power; - -..out "Sum: "; -..out sum_val; -..out "Product: "; -..out prod_val; -..out "Power: "; -..out pow_val; - -/* Test 5: Tables with function calls */ -..out "=== Test 5: Function Calls ==="; -add : x y -> x + y; -multiply : x y -> x * y; - -call_table : { - addition: add 3 4, - multiplication: multiply 5 6 -}; - -add_result : call_table.addition; -mult_result : call_table.multiplication; - -..out "Addition: "; -..out add_result; -..out "Multiplication: "; -..out mult_result; - -/* Test 6: Tables with bracket notation access */ -..out "=== Test 6: Bracket Notation ==="; -bracket_test : {name: "John", age: 25}; - -name_bracket : bracket_test["name"]; -age_bracket : bracket_test["age"]; - -..out "Name (bracket): "; -..out name_bracket; -..out "Age (bracket): "; -..out age_bracket; - -/* Test 7: Tables with string keys */ -..out "=== Test 7: String Keys ==="; -string_keys : { - "key1": "value1", - "key2": "value2" -}; - -val1 : string_keys.key1; -val2 : string_keys["key2"]; - -..out "Value 1: "; -..out val1; -..out "Value 2: "; -..out val2; - -/* Test 8: Tables with numeric keys */ -..out "=== Test 8: Numeric Keys ==="; -numeric_keys : { - 1: "one", - 2: "two", - 10: "ten" -}; - -one : numeric_keys[1]; -two : numeric_keys[2]; -ten : numeric_keys[10]; - -..out "One: "; -..out one; -..out "Two: "; -..out two; -..out "Ten: "; -..out ten; - -/* Test 9: Tables with boolean keys */ -..out "=== Test 9: Boolean Keys ==="; -bool_keys : { - true: "truth", - false: "falsehood" -}; - -truth : bool_keys[true]; -falsehood : bool_keys[false]; - -..out "Truth: "; -..out truth; -..out "Falsehood: "; -..out falsehood; - -/* Test 10: Tables with trailing commas */ -..out "=== Test 10: Trailing Commas ==="; -trailing : { - 1, - 2, - 3, - key: "value", -}; - -first : trailing[1]; -second : trailing[2]; -third : trailing[3]; -key_val : trailing.key; - -..out "First: "; -..out first; -..out "Second: "; -..out second; -..out "Third: "; -..out third; -..out "Key: "; -..out key_val; - -/* Test 11: Tables with leading commas */ -..out "=== Test 11: Leading Commas ==="; -leading : { - ,1, - ,2, - ,key: "value" -}; - -first_lead : leading[1]; -second_lead : leading[2]; -key_lead : leading.key; - -..out "First (leading): "; -..out first_lead; -..out "Second (leading): "; -..out second_lead; -..out "Key (leading): "; -..out key_lead; - -/* Test 12: Tables with function definitions inside */ -..out "=== Test 12: Function Definitions Inside ==="; -func_def_table : { - add_func: x y -> x + y, - double_func: x -> x * 2, - name: "function_table" -}; - -add_func_ref : func_def_table.add_func; -double_func_ref : func_def_table.double_func; -func_name : func_def_table.name; - -..out "Add func ref: "; -..out add_func_ref; -..out "Double func ref: "; -..out double_func_ref; -..out "Func name: "; -..out func_name; - -/* Test 13: Tables with case expressions inside */ -..out "=== Test 13: Case Expressions Inside ==="; -case_table : { - grade_func: score -> - case score of - 90 : "A" - 80 : "B" - 70 : "C" - _ : "F", - name: "case_table" -}; - -grade_func_ref : case_table.grade_func; -case_name : case_table.name; - -..out "Grade func ref: "; -..out grade_func_ref; -..out "Case name: "; -..out case_name; - -/* Test 14: Tables with standard library functions */ -..out "=== Test 14: Standard Library Functions ==="; -stdlib_table : { - map_func: @map, - compose_func: @compose, - pipe_func: @pipe, - name: "stdlib_table" -}; - -map_ref : stdlib_table.map_func; -compose_ref : stdlib_table.compose_func; -pipe_ref : stdlib_table.pipe_func; -stdlib_name : stdlib_table.name; - -..out "Map ref: "; -..out map_ref; -..out "Compose ref: "; -..out compose_ref; -..out "Pipe ref: "; -..out pipe_ref; -..out "Stdlib name: "; -..out stdlib_name; - -/* Test 15: Tables with IO operations */ -..out "=== Test 15: IO Operations ==="; -io_table : { - input_func: @..in, - output_func: @..out, - assert_func: @..assert, - name: "io_table" -}; - -input_ref : io_table.input_func; -output_ref : io_table.output_func; -assert_ref : io_table.assert_func; -io_name : io_table.name; - -..out "Input ref: "; -..out input_ref; -..out "Output ref: "; -..out output_ref; -..out "Assert ref: "; -..out assert_ref; -..out "IO name: "; -..out io_name; - -..out "Edge cases tests complete!"; \ No newline at end of file |