diff options
Diffstat (limited to 'awk/rawk/tests/core')
-rw-r--r-- | awk/rawk/tests/core/README.md | 108 | ||||
-rw-r--r-- | awk/rawk/tests/core/test_array_fix.rawk | 50 | ||||
-rw-r--r-- | awk/rawk/tests/core/test_basic.rawk | 26 | ||||
-rw-r--r-- | awk/rawk/tests/core/test_basic_functions.rawk | 171 | ||||
-rw-r--r-- | awk/rawk/tests/core/test_edge_cases.rawk | 59 | ||||
-rw-r--r-- | awk/rawk/tests/core/test_failure.rawk | 16 | ||||
-rw-r--r-- | awk/rawk/tests/core/test_multiline.rawk | 43 | ||||
-rw-r--r-- | awk/rawk/tests/core/test_new_predicates.rawk | 44 | ||||
-rw-r--r-- | awk/rawk/tests/core/test_recursive.rawk | 53 | ||||
-rw-r--r-- | awk/rawk/tests/core/test_suite.rawk | 145 |
10 files changed, 0 insertions, 715 deletions
diff --git a/awk/rawk/tests/core/README.md b/awk/rawk/tests/core/README.md deleted file mode 100644 index 21ae650..0000000 --- a/awk/rawk/tests/core/README.md +++ /dev/null @@ -1,108 +0,0 @@ -# Core Language Tests - -This directory contains tests for the fundamental features of the rawk language. - -## Test Files - -### `test_suite.rawk` - Comprehensive Test Suite -The main test suite that covers all core language features: -- Basic function definitions and calls -- Multi-line functions -- Nested function calls -- Function calls within function bodies -- Edge cases and error conditions -- Boolean assertions -- Array operations -- Conditional expressions -- Complex expressions - -**Run with:** -```bash -awk -f ../../rawk.awk test_suite.rawk | awk -f - -``` - -### `test_basic.rawk` - Basic Functions -Tests basic single-line function definitions and calls: -- Addition, multiplication, string concatenation -- Function call replacement with internal names - -**Run with:** -```bash -awk -f ../../rawk.awk test_basic.rawk | awk -f - -``` - -### `test_multiline.rawk` - Multi-line Functions -Tests multi-line function definitions: -- Complex function bodies with multiple statements -- Return statements -- Array processing within functions - -**Run with:** -```bash -awk -f ../../rawk.awk test_multiline.rawk | awk -f - -``` - -### `test_edge_cases.rawk` - Edge Cases -Tests edge cases and error conditions: -- Functions with no arguments -- Functions with many arguments -- Complex expressions -- String operations -- Conditional expressions -- Array access - -**Run with:** -```bash -awk -f ../../rawk.awk test_edge_cases.rawk | awk -f - -``` - -### `test_recursive.rawk` - Recursive Functions -Tests recursive function support: -- Factorial function -- Fibonacci function -- Countdown function -- Self-referential function calls - -**Run with:** -```bash -awk -f ../../rawk.awk test_recursive.rawk | awk -f - -``` - -### `test_array_fix.rawk` - Array Handling -Tests array operations and utilities: -- Basic array operations -- Standard library array functions -- Associative arrays -- Array statistics - -**Run with:** -```bash -awk -f ../../rawk.awk test_array_fix.rawk | awk -f - -``` - -### `test_failure.rawk` - Assertion Failures -Demonstrates the assertion system: -- Shows how failing tests are reported -- Tests error message formatting -- Validates test framework functionality - -**Run with:** -```bash -awk -f ../../rawk.awk test_failure.rawk | awk -f - 2>&1 -``` - -## Expected Results - -All tests should pass with clear output showing: -- ✓ Test results with descriptions -- 🎉 Success messages -- Proper error reporting for failures - -The comprehensive test suite should show: -``` -=== Test Summary === -Total tests: 15 -Passed: 15 -Failed: 0 -🎉 All tests passed! -``` \ No newline at end of file diff --git a/awk/rawk/tests/core/test_array_fix.rawk b/awk/rawk/tests/core/test_array_fix.rawk deleted file mode 100644 index e488762..0000000 --- a/awk/rawk/tests/core/test_array_fix.rawk +++ /dev/null @@ -1,50 +0,0 @@ -# Test to isolate array handling issues -$test_array_func = (arr) -> { - return "Array has " length(arr) " elements" -}; - -BEGIN { - print "=== Testing Array Handling ===" - - # Test basic array operations - data[1] = 10 - data[2] = 20 - data[3] = 30 - - # Test our custom function - result = test_array_func(data) - expect_equal(result, "Array has 3 elements", "test_array_func should return correct count") - print "✓ " result - - # Test keys function - key_count = keys(data) - expect_equal(key_count, 3, "keys() should return count of 3") - get_keys(data, key_array) - expect_true(key_array[1] == 1 || key_array[1] == 2 || key_array[1] == 3, "First key should be 1, 2, or 3") - expect_true(key_array[2] == 1 || key_array[2] == 2 || key_array[2] == 3, "Second key should be 1, 2, or 3") - expect_true(key_array[3] == 1 || key_array[3] == 2 || key_array[3] == 3, "Third key should be 1, 2, or 3") - print "✓ keys() function works correctly" - - # Test values function - value_count = values(data) - expect_equal(value_count, 3, "values() should return count of 3") - get_values(data, value_array) - expect_true(value_array[1] == 10 || value_array[1] == 20 || value_array[1] == 30, "First value should be 10, 20, or 30") - expect_true(value_array[2] == 10 || value_array[2] == 20 || value_array[2] == 30, "Second value should be 10, 20, or 30") - expect_true(value_array[3] == 10 || value_array[3] == 20 || value_array[3] == 30, "Third value should be 10, 20, or 30") - print "✓ values() function works correctly" - - # Test associative array - info["name"] = "rawk" - info["type"] = "language" - info["target"] = "awk" - - info_key_count = keys(info) - info_value_count = values(info) - - expect_equal(info_key_count, 3, "keys() should work with associative arrays") - expect_equal(info_value_count, 3, "values() should work with associative arrays") - print "✓ Associative array operations work correctly" - - print "🎉 All array handling tests passed!" -} \ No newline at end of file diff --git a/awk/rawk/tests/core/test_basic.rawk b/awk/rawk/tests/core/test_basic.rawk deleted file mode 100644 index d92091a..0000000 --- a/awk/rawk/tests/core/test_basic.rawk +++ /dev/null @@ -1,26 +0,0 @@ -# Basic rawk function definitions -$add = (x, y) -> x + y; -$multiply = (a, b) -> a * b; -$greet = (name) -> "Hello, " name; - -# Test the functions -BEGIN { - print "Testing basic functions:" - - # Test add function - result = add(5, 3) - expect_equal(result, 8, "add(5, 3) should return 8") - print "✓ add(5, 3) = " result - - # Test multiply function - result = multiply(4, 7) - expect_equal(result, 28, "multiply(4, 7) should return 28") - print "✓ multiply(4, 7) = " result - - # Test greet function - result = greet("World") - expect_equal(result, "Hello, World", "greet(\"World\") should return 'Hello, World'") - print "✓ greet(\"World\") = " result - - print "🎉 All basic function tests passed!" -} \ No newline at end of file diff --git a/awk/rawk/tests/core/test_basic_functions.rawk b/awk/rawk/tests/core/test_basic_functions.rawk deleted file mode 100644 index 4c354ab..0000000 --- a/awk/rawk/tests/core/test_basic_functions.rawk +++ /dev/null @@ -1,171 +0,0 @@ -# Test suite for rawk basic functionality -# This demonstrates functions using standard awk flow control - -BEGIN { - print "=== rawk Basic Functionality Test Suite ===" - print "" - - # Test counters - total_tests = 0 - passed_tests = 0 - failed_tests = 0 - - # Helper function to run tests - $run_test = (name, actual, expected) -> { - total_tests++ - if (actual == expected) { - passed_tests++ - print "✓ " name - } else { - failed_tests++ - print "❌ " name " (expected '" expected "', got '" actual "')" - } - } - - # Basic function for number classification using if/else - $classify_number = (value) -> { - if (value == 0) { - return "zero" - } else if (value > 0) { - return "positive" - } else { - return "negative" - } - } - - # Basic function for string classification - $classify_string = (str) -> { - if (str == "") { - return "empty" - } else if (is_alpha(str)) { - return "alphabetic" - } else if (is_numeric(str)) { - return "numeric" - } else { - return "other" - } - } - - # Basic function for type checking - $classify_type = (value) -> { - if (is_number(value)) { - return "number" - } else if (is_empty(value)) { - return "empty" - } else { - return "string" - } - } - - # Basic function for validation - $validate_input = (value) -> { - if (value == "") { - return "empty input" - } else if (is_number(value) && is_in_range(value, 1, 100)) { - return "valid number in range" - } else { - return "invalid input" - } - } - - # Recursive Fibonacci function using if/else - $fibonacci = (n) -> { - if (n == 0) { - return 0 - } else if (n == 1) { - return 1 - } else { - return fibonacci(n - 1) + fibonacci(n - 2) - } - } - - # Recursive factorial function using if/else - $factorial = (n) -> { - if (n == 0) { - return 1 - } else if (n == 1) { - return 1 - } else { - return n * factorial(n - 1) - } - } - - # Single-line functions - $add = (a, b) -> a + b - $multiply = (a, b) -> a * b - $square = (x) -> x * x - $is_even = (n) -> n % 2 == 0 - $is_odd = (n) -> n % 2 == 1 - $max = (a, b) -> a > b ? a : b - $min = (a, b) -> a < b ? a : b - $abs = (x) -> x < 0 ? -x : x - - # Test number classification - print "=== Number Classification Tests ===" - run_test("classify 0", classify_number(0), "zero") - run_test("classify positive", classify_number(42), "positive") - run_test("classify negative", classify_number(-5), "negative") - print "" - - # Test string classification - print "=== String Classification Tests ===" - run_test("classify empty string", classify_string(""), "empty") - run_test("classify alphabetic", classify_string("hello"), "alphabetic") - run_test("classify numeric", classify_string("123"), "numeric") - run_test("classify other", classify_string("hello123"), "other") - print "" - - # Test type checking - print "=== Type Checking Tests ===" - run_test("classify number type", classify_type(42), "number") - run_test("classify string type", classify_type("hello"), "string") - run_test("classify empty type", classify_type(""), "empty") - print "" - - # Test validation - print "=== Validation Tests ===" - run_test("validate empty", validate_input(""), "empty input") - run_test("validate valid number", validate_input(50), "valid number in range") - run_test("validate invalid number", validate_input(150), "invalid input") - print "" - - # Test recursive functions - print "=== Recursive Function Tests ===" - run_test("fibonacci(0)", fibonacci(0), 0) - run_test("fibonacci(1)", fibonacci(1), 1) - run_test("fibonacci(5)", fibonacci(5), 5) - run_test("fibonacci(10)", fibonacci(10), 55) - print "" - - run_test("factorial(0)", factorial(0), 1) - run_test("factorial(1)", factorial(1), 1) - run_test("factorial(5)", factorial(5), 120) - run_test("factorial(6)", factorial(6), 720) - print "" - - # Test single-line functions - print "=== Single-Line Function Tests ===" - run_test("add(2, 3)", add(2, 3), 5) - run_test("multiply(4, 5)", multiply(4, 5), 20) - run_test("square(6)", square(6), 36) - run_test("is_even(4)", is_even(4), 1) - run_test("is_even(5)", is_even(5), 0) - run_test("is_odd(3)", is_odd(3), 1) - run_test("is_odd(4)", is_odd(4), 0) - run_test("max(10, 20)", max(10, 20), 20) - run_test("min(10, 20)", min(10, 20), 10) - run_test("abs(-5)", abs(-5), 5) - run_test("abs(5)", abs(5), 5) - print "" - - # Test summary - print "=== Test Summary ===" - print "Total tests: " total_tests - print "Passed: " passed_tests - print "Failed: " failed_tests - print "Success rate: " (passed_tests / total_tests * 100) "%" - - if (failed_tests > 0) { - exit 1 - } -} \ No newline at end of file diff --git a/awk/rawk/tests/core/test_edge_cases.rawk b/awk/rawk/tests/core/test_edge_cases.rawk deleted file mode 100644 index 8196acd..0000000 --- a/awk/rawk/tests/core/test_edge_cases.rawk +++ /dev/null @@ -1,59 +0,0 @@ -# Test edge cases and error conditions -$no_args = () -> "no arguments"; -$single_arg = (x) -> x; -$many_args = (a, b, c, d, e) -> a + b + c + d + e; -$empty_body = (x) -> ; -$complex_expr = (x, y) -> (x * y) + (x / y) - (x % y); - -# Test functions with different argument patterns -$string_concat = (str1, str2) -> str1 " " str2; -$array_access = (arr, idx) -> arr[idx]; -$conditional = (x) -> x > 0 ? "positive" : "negative"; - -# Test the edge cases -BEGIN { - print "=== Testing Edge Cases ===" - - # Test no arguments - result = no_args() - expect_equal(result, "no arguments", "no_args() should return 'no arguments'") - print "✓ no_args() = " result - - # Test single argument - result = single_arg(42) - expect_equal(result, 42, "single_arg(42) should return 42") - print "✓ single_arg(42) = " result - - # Test many arguments - result = many_args(1,2,3,4,5) - expect_equal(result, 15, "many_args(1,2,3,4,5) should return 15") - print "✓ many_args(1,2,3,4,5) = " result - - # Test complex expressions - result = complex_expr(10, 3) - expect_true(result > 32.3 && result < 32.4, "complex_expr(10, 3) should be approximately 32.3333") - print "✓ complex_expr(10, 3) = " result - - # Test string concatenation - result = string_concat("Hello", "World") - expect_equal(result, "Hello World", "string_concat(\"Hello\", \"World\") should return 'Hello World'") - print "✓ string_concat(\"Hello\", \"World\") = " result - - # Test conditional - result = conditional(5) - expect_equal(result, "positive", "conditional(5) should return 'positive'") - print "✓ conditional(5) = " result - - result = conditional(-3) - expect_equal(result, "negative", "conditional(-3) should return 'negative'") - print "✓ conditional(-3) = " result - - # Test array access - test_arr[1] = "first" - test_arr[2] = "second" - result = array_access(test_arr, 2) - expect_equal(result, "second", "array_access(test_arr, 2) should return 'second'") - print "✓ array_access(test_arr, 2) = " result - - print "🎉 All edge case tests passed!" -} \ No newline at end of file diff --git a/awk/rawk/tests/core/test_failure.rawk b/awk/rawk/tests/core/test_failure.rawk deleted file mode 100644 index adeafa5..0000000 --- a/awk/rawk/tests/core/test_failure.rawk +++ /dev/null @@ -1,16 +0,0 @@ -# Test that demonstrates failing assertions -$add = (x, y) -> x + y; - -BEGIN { - print "Testing assertion failures (this should fail):" - - # This should pass - result = add(2, 3) - expect_equal(result, 5, "add(2, 3) should return 5") - print "✓ This assertion should pass" - - # This should fail - result = add(2, 3) - expect_equal(result, 10, "add(2, 3) should return 10 (this will fail)") - print "This line should not be reached" -} \ No newline at end of file diff --git a/awk/rawk/tests/core/test_multiline.rawk b/awk/rawk/tests/core/test_multiline.rawk deleted file mode 100644 index 95a889f..0000000 --- a/awk/rawk/tests/core/test_multiline.rawk +++ /dev/null @@ -1,43 +0,0 @@ -# Multi-line rawk function definitions -$calculate_area = (width, height) -> { - area = width * height - return area -}; - -$format_message = (name, age) -> { - message = "Name: " name ", Age: " age - return message -}; - -$process_array = (arr) -> { - sum = 0 - for (i in arr) { - sum += arr[i] - } - return sum -}; - -# Test the multi-line functions -BEGIN { - print "Testing multi-line functions:" - - # Test calculate_area function - result = calculate_area(5, 3) - expect_equal(result, 15, "calculate_area(5, 3) should return 15") - print "✓ calculate_area(5, 3) = " result - - # Test format_message function - result = format_message("Alice", 30) - expect_equal(result, "Name: Alice, Age: 30", "format_message(\"Alice\", 30) should return 'Name: Alice, Age: 30'") - print "✓ format_message(\"Alice\", 30) = " result - - # Test with array - test_array[1] = 10 - test_array[2] = 20 - test_array[3] = 30 - result = process_array(test_array) - expect_equal(result, 60, "process_array([10,20,30]) should return 60") - print "✓ process_array([10,20,30]) = " result - - print "🎉 All multi-line function tests passed!" -} \ No newline at end of file diff --git a/awk/rawk/tests/core/test_new_predicates.rawk b/awk/rawk/tests/core/test_new_predicates.rawk deleted file mode 100644 index d5c14c9..0000000 --- a/awk/rawk/tests/core/test_new_predicates.rawk +++ /dev/null @@ -1,44 +0,0 @@ -# Test new predicate functions: is_uuid and is_ipv6 - -BEGIN { - print "=== Testing New Predicate Functions ===" - - # Test is_uuid function - print "" - print "--- Testing is_uuid ---" - - # Valid UUIDs - expect_true(is_uuid("550e8400-e29b-41d4-a716-446655440000"), "Valid UUID should return true") - expect_true(is_uuid("6ba7b810-9dad-11d1-80b4-00c04fd430c8"), "Valid UUID should return true") - expect_true(is_uuid("6ba7b811-9dad-11d1-80b4-00c04fd430c8"), "Valid UUID should return true") - - # Invalid UUIDs - expect_false(is_uuid(""), "Empty string should return false") - expect_false(is_uuid("not-a-uuid"), "Invalid format should return false") - expect_false(is_uuid("550e8400-e29b-41d4-a716-44665544000"), "Too short should return false") - expect_false(is_uuid("550e8400-e29b-41d4-a716-4466554400000"), "Too long should return false") - expect_false(is_uuid("550e8400e29b41d4a716446655440000"), "Missing hyphens should return false") - expect_false(is_uuid("550e8400-e29b-41d4-a716-44665544000g"), "Invalid hex should return false") - - # Test is_ipv6 function - print "" - print "--- Testing is_ipv6 ---" - - # Valid IPv6 addresses - expect_true(is_ipv6("2001:0db8:85a3:0000:0000:8a2e:0370:7334"), "Valid IPv6 should return true") - expect_true(is_ipv6("2001:db8:85a3::8a2e:370:7334"), "Valid IPv6 with :: should return true") - expect_true(is_ipv6("::1"), "Localhost IPv6 should return true") - expect_true(is_ipv6("fe80::1ff:fe23:4567:890a"), "Valid IPv6 should return true") - expect_true(is_ipv6("2001:0db8:0000:0000:0000:0000:0000:0001"), "Valid IPv6 should return true") - - # Invalid IPv6 addresses - expect_false(is_ipv6(""), "Empty string should return false") - expect_false(is_ipv6("192.168.1.1"), "IPv4 should return false") - expect_false(is_ipv6("not-an-ip"), "Invalid format should return false") - expect_false(is_ipv6("2001:0db8:85a3:0000:0000:8a2e:0370:7334:extra"), "Too many segments should return false") - expect_false(is_ipv6("2001:0db8:85a3:0000:0000:8a2e:0370"), "Too few segments should return false") - expect_false(is_ipv6("2001:0db8:85a3:0000:0000:8a2e:0370:733g"), "Invalid hex should return false") - - print "" - print "🎉 All new predicate function tests passed!" -} \ No newline at end of file diff --git a/awk/rawk/tests/core/test_recursive.rawk b/awk/rawk/tests/core/test_recursive.rawk deleted file mode 100644 index 4e89a4d..0000000 --- a/awk/rawk/tests/core/test_recursive.rawk +++ /dev/null @@ -1,53 +0,0 @@ -# Test recursive functions -$factorial = (n) -> { - if (n <= 1) { - return 1 - } else { - return n * factorial(n - 1) - } -}; - -$fibonacci = (n) -> { - if (n <= 1) { - return n - } else { - return fibonacci(n - 1) + fibonacci(n - 2) - } -}; - -$countdown = (n) -> { - if (n <= 0) { - return "Done!" - } else { - return n " " countdown(n - 1) - } -}; - -BEGIN { - print "=== Testing Recursive Functions ===" - - # Test factorial - result = factorial(5) - expect_equal(result, 120, "factorial(5) should return 120") - print "✓ factorial(5) = " result - - result = factorial(3) - expect_equal(result, 6, "factorial(3) should return 6") - print "✓ factorial(3) = " result - - # Test fibonacci - result = fibonacci(6) - expect_equal(result, 8, "fibonacci(6) should return 8") - print "✓ fibonacci(6) = " result - - result = fibonacci(4) - expect_equal(result, 3, "fibonacci(4) should return 3") - print "✓ fibonacci(4) = " result - - # Test countdown - result = countdown(3) - expect_equal(result, "3 2 1 Done!", "countdown(3) should return '3 2 1 Done!'") - print "✓ countdown(3) = " result - - print "🎉 All recursive function tests passed!" -} \ No newline at end of file diff --git a/awk/rawk/tests/core/test_suite.rawk b/awk/rawk/tests/core/test_suite.rawk deleted file mode 100644 index fd069aa..0000000 --- a/awk/rawk/tests/core/test_suite.rawk +++ /dev/null @@ -1,145 +0,0 @@ -# rawk Test Suite -# This file tests all major features of the rawk language using assertions - -# Basic function definitions for testing -$add = (x, y) -> x + y; -$multiply = (a, b) -> a * b; -$greet = (name) -> "Hello, " name; -$square = (x) -> x * x; -$double = (x) -> x * 2; - -# Multi-line function for testing -$calculate_area = (width, height) -> { - area = width * height - return area -}; - -# Function that calls other functions -$complex_calc = (x, y) -> { - doubled = double(x) - squared = square(y) - result = add(doubled, squared) - return result -}; - -# Test runner -BEGIN { - print "=== rawk Test Suite ===" - test_count = 0 - passed_count = 0 - - # Test 1: Basic single-line functions - test_count++ - result = add(5, 3) - expect_equal(result, 8, "add(5, 3) should return 8") - passed_count++ - print "✓ Test " test_count ": Basic addition" - - test_count++ - result = multiply(4, 7) - expect_equal(result, 28, "multiply(4, 7) should return 28") - passed_count++ - print "✓ Test " test_count ": Basic multiplication" - - test_count++ - result = greet("World") - expect_equal(result, "Hello, World", "greet(\"World\") should return 'Hello, World'") - passed_count++ - print "✓ Test " test_count ": String concatenation" - - # Test 2: Multi-line functions - test_count++ - result = calculate_area(5, 3) - expect_equal(result, 15, "calculate_area(5, 3) should return 15") - passed_count++ - print "✓ Test " test_count ": Multi-line function" - - # Test 3: Nested function calls - test_count++ - result = double(square(3)) - expect_equal(result, 18, "double(square(3)) should return 18") - passed_count++ - print "✓ Test " test_count ": Nested function calls" - - test_count++ - result = square(double(3)) - expect_equal(result, 36, "square(double(3)) should return 36") - passed_count++ - print "✓ Test " test_count ": Different nested function order" - - # Test 4: Function calls within function bodies - test_count++ - result = complex_calc(3, 4) - expect_equal(result, 22, "complex_calc(3, 4) should return 22") - passed_count++ - print "✓ Test " test_count ": Function calls within function bodies" - - # Test 5: Edge cases - test_count++ - result = add(0, 0) - expect_equal(result, 0, "add(0, 0) should return 0") - passed_count++ - print "✓ Test " test_count ": Zero values" - - test_count++ - result = multiply(-2, 3) - expect_equal(result, -6, "multiply(-2, 3) should return -6") - passed_count++ - print "✓ Test " test_count ": Negative numbers" - - # Test 6: String operations - test_count++ - result = greet("") - expect_equal(result, "Hello, ", "greet(\"\") should return 'Hello, '") - passed_count++ - print "✓ Test " test_count ": Empty string" - - # Test 7: Boolean assertions - test_count++ - expect_true(add(2, 2) == 4, "2 + 2 should equal 4") - passed_count++ - print "✓ Test " test_count ": Boolean true assertion" - - test_count++ - expect_false(add(2, 2) == 5, "2 + 2 should not equal 5") - passed_count++ - print "✓ Test " test_count ": Boolean false assertion" - - # Test 8: Array operations (basic) - test_count++ - data[1] = 10 - data[2] = 20 - data[3] = 30 - expect_equal(data[1], 10, "data[1] should be 10") - expect_equal(data[2], 20, "data[2] should be 20") - expect_equal(data[3], 30, "data[3] should be 30") - passed_count++ - print "✓ Test " test_count ": Basic array operations" - - # Test 9: Conditional expressions - test_count++ - result = 5 > 3 ? "greater" : "less" - expect_equal(result, "greater", "5 > 3 should be 'greater'") - passed_count++ - print "✓ Test " test_count ": Conditional expressions" - - # Test 10: Complex expressions - test_count++ - result = (2 + 3) * 4 - expect_equal(result, 20, "(2 + 3) * 4 should be 20") - passed_count++ - print "✓ Test " test_count ": Complex expressions" - - # Summary - print "\n=== Test Summary ===" - print "Total tests: " test_count - print "Passed: " passed_count - print "Failed: " (test_count - passed_count) - - if (passed_count == test_count) { - print "🎉 All tests passed!" - } else { - print "❌ Some tests failed!" - exit 1 - } -} \ No newline at end of file |