This directory contains all tests for the MiniScript 2.0 project, organized separately from production code.
tests/
├── cpp/ # C++ tests
│ ├── unit/ # Unit tests for core/compiler components
│ ├── parser/ # Parser and lexer tests
│ ├── vm/ # Virtual machine tests
│ └── integration/ # End-to-end integration tests
├── cs/ # C# tests
├── fixtures/ # Shared test data
│ ├── expressions/ # Expression test cases
│ ├── scripts/ # Full script test cases
│ └── expected_outputs/ # Expected output files
└── README.md # This file
From the project root:
# Run all tests
./tools/build.sh test-all
# Run C++ tests only
./tools/build.sh test-cpp
# Run C# tests only
./tools/build.sh test-cs
# Run specific test categories
./tools/build.sh test-parser
./tools/build.sh test-vmFrom the tests/ directory:
# Run all tests
make all
# Run specific categories
make parser
make vm
make unit
make integration
# Clean test builds
make clean
# Show help
make help# C++ Parser tests
cd tests/cpp/parser
make test
# C# Parser tests
cd tests/cs/parser
make test
# VM tests (when implemented)
cd tests/cpp/vm
make test-
unit/ - Unit tests for individual components
- Memory pool tests
- String class tests
- Dictionary tests
- etc.
-
parser/ - Parser and lexer tests
- Lexer tokenization tests
- Parser grammar tests
- AST generation tests
-
vm/ - Virtual machine tests
- Opcode execution tests
- Function call tests
- Expression evaluation tests
-
integration/ - End-to-end tests
- Full compilation pipeline
- Cross-language consistency tests
- parser/ - Parser and lexer tests
- Tests GPPG-generated parser with hand-written lexer
- Same test cases as C++ parser tests
- Ensures C# and C++ parsers produce identical results
- Shared test input files
- Expected output files
- Test scripts and expressions
- Create test file in appropriate directory:
// tests/cpp/unit/test_my_feature.cpp
#include "path/to/my_feature.h"
#include <iostream>
int main() {
// Test code here
std::cout << "Test: my_feature" << std::endl;
// Add assertions
return 0; // 0 = success
}-
Add to Makefile in that directory
-
Run with
make test
(To be added when C# test infrastructure is set up)
All test executables are built to:
build/tests/cpp/[category]/test_name
build/tests/cs/[category]/test_name
This keeps test builds separate from production builds.
Before running tests:
- Build the core library:
cd cpp
make- Build the compiler library (for parser tests):
cd cpp/compiler
make- Then run tests:
./tools/build.sh test-all(To be added: instructions for running tests in CI/CD pipelines)
To debug a specific test:
# Build the test with debug symbols
cd tests/cpp/parser
make clean
CXXFLAGS="-g -O0" make
# Run with debugger
lldb build/tests/cpp/parser/test_parser(To be added: instructions for generating coverage reports)
When adding new features:
- Add tests in the appropriate
tests/subdirectory - Ensure tests pass for both C# and C++ implementations
- Update this README if adding new test categories
