about summary refs log tree commit diff stats
path: root/js/scripting-lang/baba-yaga-c/run_tests.sh
diff options
context:
space:
mode:
Diffstat (limited to 'js/scripting-lang/baba-yaga-c/run_tests.sh')
-rwxr-xr-xjs/scripting-lang/baba-yaga-c/run_tests.sh275
1 files changed, 0 insertions, 275 deletions
diff --git a/js/scripting-lang/baba-yaga-c/run_tests.sh b/js/scripting-lang/baba-yaga-c/run_tests.sh
deleted file mode 100755
index 032b0ee..0000000
--- a/js/scripting-lang/baba-yaga-c/run_tests.sh
+++ /dev/null
@@ -1,275 +0,0 @@
-#!/bin/bash
-
-# Test Runner for Baba Yaga C Implementation
-# Runs unit tests and integration tests systematically
-
-echo "=== Baba Yaga C Implementation Test Suite ==="
-echo ""
-
-# Colors for output
-RED='\033[0;31m'
-GREEN='\033[0;32m'
-YELLOW='\033[1;33m'
-BLUE='\033[0;34m'
-NC='\033[0m' # No Color
-
-# Function to run a test
-run_test() {
-    local test_file=$1
-    local test_name=$2
-    
-    echo -n "Running $test_name... "
-    
-    # For now, just check if the file can be parsed without errors
-    # We'll implement full test execution later
-    local output
-    local exit_code
-    output=$(./bin/baba-yaga "$(head -1 "$test_file" | sed 's/^[[:space:]]*\/\*.*\*\/[[:space:]]*//')" 2>&1)
-    exit_code=$?
-    
-    if [ $exit_code -eq 0 ]; then
-        echo -e "${GREEN}PASS${NC}"
-        return 0
-    else
-        echo -e "${RED}FAIL${NC}"
-        echo -e "${RED}Error:${NC} $output"
-        return 1
-    fi
-}
-
-# Function to run a simple test
-run_simple_test() {
-    local expression=$1
-    local expected=$2
-    local test_name=$3
-    
-    echo -n "Testing $test_name... "
-    
-    local output
-    local exit_code
-    output=$(./bin/baba-yaga "$expression" 2>&1)
-    exit_code=$?
-    
-    if [ $exit_code -eq 0 ] && [ "$(echo -n "$output")" = "$expected" ]; then
-        echo -e "${GREEN}PASS${NC} (got: $output)"
-        return 0
-    else
-        echo -e "${RED}FAIL${NC}"
-        echo -e "${RED}Expected:${NC} $expected"
-        echo -e "${RED}Got:${NC} $output"
-        return 1
-    fi
-}
-
-# Function to run a test that should fail
-run_failure_test() {
-    local expression=$1
-    local test_name=$2
-    
-    echo -n "Testing $test_name (should fail)... "
-    
-    local output
-    local exit_code
-    output=$(./bin/baba-yaga "$expression" 2>&1)
-    exit_code=$?
-    
-    if [ $exit_code -ne 0 ]; then
-        echo -e "${GREEN}PASS${NC} (correctly failed)"
-        return 0
-    else
-        echo -e "${RED}FAIL${NC} (should have failed but didn't)"
-        echo -e "${RED}Output:${NC} $output"
-        return 1
-    fi
-}
-
-# Counters
-total_tests=0
-passed_tests=0
-failed_tests=0
-
-echo "Running Basic Functionality Tests..."
-echo "==================================="
-
-# Basic arithmetic tests
-basic_tests=(
-    "5 + 3:8:Basic Addition"
-    "10 - 3:7:Basic Subtraction"
-    "6 * 7:42:Basic Multiplication"
-    "15 / 3:5:Basic Division"
-    "10 % 3:1:Basic Modulo"
-    "2 ^ 3:8:Basic Power"
-)
-
-for test in "${basic_tests[@]}"; do
-    IFS=':' read -r expression expected name <<< "$test"
-    total_tests=$((total_tests + 1))
-    
-    if run_simple_test "$expression;" "$expected" "$name"; then
-        passed_tests=$((passed_tests + 1))
-    else
-        failed_tests=$((failed_tests + 1))
-    fi
-done
-
-echo ""
-echo "Running Function Call Tests..."
-echo "============================="
-
-# Function call tests
-function_tests=(
-    "add 5 3:8:Add Function"
-    "subtract 10 3:7:Subtract Function"
-    "multiply 6 7:42:Multiply Function"
-    "divide 15 3:5:Divide Function"
-    "modulo 10 3:1:Modulo Function"
-    "pow 2 3:8:Power Function"
-)
-
-for test in "${function_tests[@]}"; do
-    IFS=':' read -r expression expected name <<< "$test"
-    total_tests=$((total_tests + 1))
-    
-    if run_simple_test "$expression;" "$expected" "$name"; then
-        passed_tests=$((passed_tests + 1))
-    else
-        failed_tests=$((failed_tests + 1))
-    fi
-done
-
-echo ""
-echo "Running Function Reference Tests..."
-echo "=================================="
-
-# Function reference tests
-reference_tests=(
-    "@multiply 2 3:6:Simple Function Reference"
-    "add 5 @multiply 3 4:17:Function Reference in Call"
-)
-
-for test in "${reference_tests[@]}"; do
-    IFS=':' read -r expression expected name <<< "$test"
-    total_tests=$((total_tests + 1))
-    
-    if run_simple_test "$expression;" "$expected" "$name"; then
-        passed_tests=$((passed_tests + 1))
-    else
-        failed_tests=$((failed_tests + 1))
-    fi
-done
-
-echo ""
-echo "Running Variable Assignment Tests..."
-echo "==================================="
-
-# Variable assignment tests
-variable_tests=(
-    "x : 42|42|Simple Variable Assignment"
-    "x : 10; y : 20; add x y|30|Multiple Statement Parsing"
-)
-
-for test in "${variable_tests[@]}"; do
-    IFS='|' read -r expression expected name <<< "$test"
-    total_tests=$((total_tests + 1))
-    
-    if run_simple_test "$expression;" "$expected" "$name"; then
-        passed_tests=$((passed_tests + 1))
-    else
-        failed_tests=$((failed_tests + 1))
-    fi
-done
-
-echo ""
-echo "Running Comparison Tests..."
-echo "=========================="
-
-# Comparison tests
-comparison_tests=(
-    "equals 5 5:true:Equality True"
-    "equals 5 6:false:Equality False"
-    "less 3 5:true:Less Than True"
-    "greater 10 5:true:Greater Than True"
-    "less_equal 5 5:true:Less Equal True"
-    "greater_equal 5 5:true:Greater Equal True"
-)
-
-for test in "${comparison_tests[@]}"; do
-    IFS=':' read -r expression expected name <<< "$test"
-    total_tests=$((total_tests + 1))
-    
-    if run_simple_test "$expression;" "$expected" "$name"; then
-        passed_tests=$((passed_tests + 1))
-    else
-        failed_tests=$((failed_tests + 1))
-    fi
-done
-
-echo ""
-echo "Running Known Limitation Tests..."
-echo "================================"
-
-# Known limitation tests (should fail or have limited functionality)
-limitation_tests=(
-    "add @multiply 2 3 @subtract 10 4:Complex Nested Function References"
-)
-
-for test in "${limitation_tests[@]}"; do
-    IFS=':' read -r expression name <<< "$test"
-    total_tests=$((total_tests + 1))
-    
-    echo -n "Testing $name (known limitation)... "
-    output=$(./bin/baba-yaga "$expression;" 2>&1)
-    exit_code=$?
-    
-    if [ $exit_code -eq 0 ]; then
-        echo -e "${BLUE}WORKING${NC} (unexpected: $output)"
-        passed_tests=$((passed_tests + 1))
-    else
-        echo -e "${YELLOW}LIMITED${NC} (as expected)"
-        passed_tests=$((passed_tests + 1))
-    fi
-done
-
-echo ""
-echo "Running Error Handling Tests..."
-echo "=============================="
-
-# Error handling tests (should fail gracefully)
-error_tests=(
-    "10 / 0:Division by Zero"
-    "undefined_var:Undefined Variable"
-    "add 1 2 3:Too Many Arguments"
-)
-
-for test in "${error_tests[@]}"; do
-    IFS=':' read -r expression name <<< "$test"
-    total_tests=$((total_tests + 1))
-    
-    echo -n "Testing $name (should fail)... "
-    output=$(./bin/baba-yaga "$expression;" 2>&1)
-    exit_code=$?
-    
-    if [ $exit_code -eq 0 ] && echo "$output" | grep -q "Error:"; then
-        echo -e "${GREEN}PASS${NC} (correctly failed with error message)"
-        passed_tests=$((passed_tests + 1))
-    else
-        echo -e "${RED}FAIL${NC}"
-        echo -e "${RED}Expected:${NC} Error message"
-        echo -e "${RED}Got:${NC} $output"
-        failed_tests=$((failed_tests + 1))
-    fi
-done
-
-echo ""
-echo "=== Test Summary ==="
-echo "Total tests: $total_tests"
-echo -e "Passed: ${GREEN}$passed_tests${NC}"
-echo -e "Failed: ${RED}$failed_tests${NC}"
-
-if [ $failed_tests -eq 0 ]; then
-    echo -e "${GREEN}All tests passed!${NC}"
-    exit 0
-else
-    echo -e "${RED}Some tests failed.${NC}"
-    exit 1
-fi 
\ No newline at end of file