about summary refs log tree commit diff stats
path: root/js/scripting-lang/tests/README.md
diff options
context:
space:
mode:
Diffstat (limited to 'js/scripting-lang/tests/README.md')
-rw-r--r--js/scripting-lang/tests/README.md183
1 files changed, 183 insertions, 0 deletions
diff --git a/js/scripting-lang/tests/README.md b/js/scripting-lang/tests/README.md
new file mode 100644
index 0000000..595dcf5
--- /dev/null
+++ b/js/scripting-lang/tests/README.md
@@ -0,0 +1,183 @@
+# Baba Yaga Shared Test Suite
+
+This directory contains the comprehensive shared test suite for the Baba Yaga scripting language, ensuring consistency between the JavaScript (reference) and C implementations.
+
+## 📁 Directory Structure
+
+```
+tests/
+├── unit/              # Unit tests (23 comprehensive test files)
+├── integration/       # Integration tests (4 test files)
+├── turing-completeness/  # Turing completeness proofs (7 test files)
+├── run_shared_tests.sh   # Unified test runner
+└── README.md          # This file
+```
+
+## 🎯 Test Categories
+
+### Unit Tests (`unit/`)
+Comprehensive tests covering all language features:
+
+1. **01_lexer_basic.txt** - Basic lexer functionality
+2. **02_arithmetic_operations.txt** - Arithmetic operations and precedence
+3. **03_comparison_operators.txt** - Comparison operators
+4. **04_logical_operators.txt** - Logical operators
+5. **05_io_operations.txt** - Input/output operations
+6. **06_function_definitions.txt** - Function definitions
+7. **07_case_expressions.txt** - Case expressions and pattern matching
+8. **08_first_class_functions.txt** - First-class function support
+9. **09_tables.txt** - Table data structures
+10. **10_standard_library.txt** - Standard library functions
+11. **11_edge_cases.txt** - Edge cases and boundary conditions
+12. **12_advanced_tables.txt** - Advanced table operations
+13. **13_standard_library_complete.txt** - Complete standard library
+14. **14_error_handling.txt** - Error handling and validation
+15. **15_performance_stress.txt** - Performance and stress tests
+16. **16_function_comparison.txt** - Advanced functional programming
+17. **17_table_enhancements.txt** - Table enhancements
+18. **18_each_combinator.txt** - Each combinator functionality
+19. **19_embedded_functions.txt** - Embedded function support
+20. **20_via_operator.txt** - Via operator functionality
+21. **21_enhanced_case_statements.txt** - Enhanced case statements
+22. **22_parser_limitations.txt** - Parser limitations and edge cases
+23. **23_minus_operator_spacing.txt** - Minus operator spacing rules
+
+### Integration Tests (`integration/`)
+Tests that combine multiple language features:
+
+1. **integration_01_basic_features.txt** - Basic feature integration
+2. **integration_02_pattern_matching.txt** - Pattern matching integration
+3. **integration_03_functional_programming.txt** - Functional programming integration
+4. **integration_04_mini_case_multi_param.txt** - Multi-parameter case expressions
+
+### Turing Completeness Tests (`turing-completeness/`)
+Formal proofs that the language is Turing complete:
+
+1. **01_basic_proof.txt** - Basic Turing completeness proof
+2. **02_recursion_demo.txt** - Recursion demonstrations
+3. **03_data_demo.txt** - Data structure demonstrations
+4. **04_simple_functions.txt** - Function demonstrations
+5. **05_loops_and_state.txt** - Loops and state management
+6. **06_lambda_calculus.txt** - Lambda calculus foundations
+7. **07_complex_algorithms.txt** - Complex algorithms
+
+## 🚀 Running Tests
+
+### Unified Test Runner (Recommended)
+
+The shared test runner can execute tests on both implementations:
+
+```bash
+# Run all tests on JavaScript implementation
+./tests/run_shared_tests.sh js
+
+# Run all tests on C implementation  
+./tests/run_shared_tests.sh c
+
+# Run specific test category
+./tests/run_shared_tests.sh js unit
+./tests/run_shared_tests.sh c integration
+./tests/run_shared_tests.sh js turing
+```
+
+### Implementation-Specific Runners
+
+Each implementation has its own test runner that uses the shared suite:
+
+**JavaScript:**
+```bash
+cd js/
+./run_tests.sh
+```
+
+**C:**
+```bash
+cd c/
+./run_tests.sh
+```
+
+## 📝 Test File Format
+
+All test files use a consistent format:
+
+```baba-yaga
+/* Test Description */
+/* Details about what the test covers */
+
+..out "=== Test Category ===";
+
+/* Test code here */
+variable : value;
+result : function argument;
+
+/* Assertions */
+..assert result = expected_value;
+..out "Test description: PASS";
+
+..out "Test completed";
+```
+
+### Key Elements:
+- **Comments**: `/* */` for test descriptions
+- **Assertions**: `..assert condition` for validation
+- **Output**: `..out message` for test progress
+- **Variables**: Standard Baba Yaga syntax
+
+## 🎖️ Implementation Consistency
+
+The shared test suite ensures:
+
+✅ **Syntax Consistency** - Both implementations parse the same code  
+✅ **Semantic Consistency** - Both implementations produce the same results  
+✅ **Feature Parity** - Both implementations support the same features  
+✅ **Error Handling** - Both implementations handle errors consistently
+
+## 🔄 Maintenance
+
+### Adding New Tests
+
+1. **Choose Category**: Determine if it's unit, integration, or Turing completeness
+2. **Follow Format**: Use the standard test file format
+3. **Add to Runners**: Update test arrays in runner scripts
+4. **Test Both**: Verify the test works on both implementations
+
+### Updating Tests
+
+1. **Modify Shared File**: Edit the test in the `tests/` directory
+2. **Verify Impact**: Run on both implementations
+3. **Update Documentation**: If behavior changes, update this README
+
+### Implementation Gaps
+
+If a test fails on one implementation but not the other:
+
+1. **Identify Gap**: Determine which implementation is correct (JS is reference)
+2. **File Issue**: Document the inconsistency
+3. **Fix or Document**: Either fix the implementation or document the limitation
+
+## 📊 Test Metrics
+
+**Total Tests**: 34 comprehensive test files  
+**Test Categories**: 3 (Unit, Integration, Turing Completeness)  
+**Coverage**: All major language features  
+**Assertions**: 200+ individual test assertions
+
+## 🤝 Contributing
+
+When contributing to the Baba Yaga language:
+
+1. **Test First**: Write tests for new features
+2. **Both Implementations**: Ensure tests work on JS and C
+3. **Shared Location**: Add tests to the shared suite
+4. **Documentation**: Update this README for new test categories
+
+## 🏆 Quality Assurance
+
+The shared test suite provides:
+
+- **Regression Testing**: Catch breaking changes
+- **Implementation Validation**: Verify both implementations work identically  
+- **Feature Coverage**: Comprehensive testing of all language features
+- **Turing Completeness**: Formal proof the language is computationally complete
+
+**Goal**: Ensure the JavaScript and C implementations of Baba Yaga are as close to identical as possible, with JS serving as the reference implementation.
\ No newline at end of file