Add ruvnet/midstream (AIMDS real-time inference) and ruvnet/sublinear-time-solver (sublinear optimization algorithms) as vendored dependencies under vendor/. |
||
|---|---|---|
| .. | ||
| binaries | ||
| consciousness | ||
| convergence | ||
| data | ||
| examples | ||
| integration | ||
| mcp | ||
| performance | ||
| rust | ||
| unit | ||
| validation | ||
| wasm | ||
| README.md | ||
| comprehensive-cache-test.js | ||
| confirm-specific-fixes.mjs | ||
| consciousness-integration.test.js | ||
| debug-wasm-execution.mjs | ||
| final-validation.mjs | ||
| index.js | ||
| large_vector_1000.json | ||
| large_vector_10000.json | ||
| matrix_1020.json | ||
| mcp-sublinear-solver-test-report.md | ||
| mcp-tools-test-report.md | ||
| mcp-tools-test-results.md | ||
| quantum_physics_validation_test.rs | ||
| run_all.cjs | ||
| strange_loops_comprehensive_test_report.md | ||
| test-api-design.js | ||
| test-cache-performance.js | ||
| test-consciousness-cli.cjs | ||
| test-consciousness-cli.js | ||
| test-large-matrix.js | ||
| test-mcp-cli.sh | ||
| test-mcp-temporal.mjs | ||
| test-mcp-wasm-direct.mjs | ||
| test-mcp-wasm.mjs | ||
| test-npm-package.mjs | ||
| test-npx-wasm.mjs | ||
| test-pagerank-fix.mjs | ||
| test-psycho-symbolic.js | ||
| test-real-wasm-solver.mjs | ||
| test-rust-wasm.mjs | ||
| test-wasm-direct.js | ||
| test-wasm-integration-final.mjs | ||
| test-wasm-simple.cjs | ||
| test-wasm-working.mjs | ||
| test-wasm.js | ||
| test_nanosecond_scheduler.rs | ||
| test_sublinear_wasm.cjs | ||
| test_true_sublinear_direct.js | ||
| test_vector_500.json | ||
| test_vector_10000.json | ||
| validate-all.js | ||
| validate-cache-final.js | ||
| validate-mcp.js | ||
| validate-wasm-complete.mjs | ||
| vector_1000.json | ||
| verify_implementation.cjs | ||
README.md
Sublinear Time Solver - Test Suite
Comprehensive testing framework for the sublinear-time-solver MCP interface project.
Test Structure
tests/
├── README.md # This file
├── mcp/ # MCP tool integration tests
│ └── mcp-tool-tests.js # Comprehensive MCP solver tool tests
├── rust/ # Rust implementation tests
│ ├── hybrid_tests.rs # Hybrid algorithm tests
│ ├── push_tests.rs # Forward/backward push algorithm tests
│ └── standalone_benchmark.rs # Performance benchmarks
├── performance/ # Performance and optimization tests
│ ├── performance-test.js # General performance tests
│ ├── optimization-benchmark.js # Optimization benchmarks
│ └── test-fast-solver.js # Fast solver implementation tests
├── validation/ # Validation and correctness tests
│ └── test-solver-fixes.js # Solver bug fixes and edge cases
├── convergence/ # Convergence analysis tests
│ ├── convergence-validation.js # Convergence validation
│ ├── mini-benchmark.js # Small-scale benchmarks
│ └── quick-test.js # Quick smoke tests
└── wasm/ # WebAssembly tests
├── wasm_test.js # WASM module tests
└── verify-wasm.js # WASM verification tests
Quick Start
Run All Tests
# Run comprehensive test suite with report generation
node tests/run_all.cjs --report
# Run with verbose output
node tests/run_all.cjs --verbose
# Run individual test suites
node tests/unit/matrix.test.cjs
node tests/unit/solver.test.cjs
node tests/integration/cli.test.cjs
node tests/integration/mcp.test.cjs
node tests/integration/wasm.test.cjs
node tests/performance/benchmark.test.cjs
Prerequisites
- Node.js 16+ installed
- NPM packages installed (
npm install) - For full WASM testing (optional):
# Install Rust toolchain curl --proto "=https" --tlsv1.2 -sSf https://sh.rustup.rs | sh # Add WASM target rustup target add wasm32-unknown-unknown # Install wasm-pack cargo install wasm-pack # Build WASM ./scripts/build.sh
Test Categories
1. Unit Tests (unit/)
Matrix Tests (matrix.test.cjs)
- Matrix constructor validation
- Static methods (zeros, identity, random)
- Access operations (get/set)
- Memory efficiency
- Mathematical properties
- Error handling
Solver Tests (solver.test.cjs)
- Solver initialization
- Basic solving operations
- Batch processing
- Memory management
- Resource cleanup
- Error classes
2. Integration Tests (integration/)
CLI Tests (cli.test.cjs)
- Command parsing
- File format support
- Error handling
- Service mode
- Signal handling
MCP Tests (mcp.test.cjs)
- Protocol compliance
- Tool definitions
- Resource providers
- JSON-RPC format
- Error responses
WASM Tests (wasm.test.cjs)
- Package structure
- JavaScript wrapper
- Performance testing
- Memory management
- Resource cleanup
3. Performance Tests (performance/)
Benchmark Tests (benchmark.test.cjs)
- Algorithm correctness
- Convergence analysis
- Scaling performance
- Memory efficiency
- Numerical stability
- Complexity validation
Test Output
Each test suite provides:
- ✅/❌ Individual test results
- Execution duration
- Detailed error messages (with
--verbose) - Summary statistics
- Performance metrics
Reports
The comprehensive test runner generates:
- JSON Report (
test_report.json) - Machine-readable results - Markdown Report (
TEST_REPORT.md) - Human-readable analysis - Benchmark Report (
benchmark_report.json) - Performance data
Mock Testing
Tests are designed to work with or without WASM build:
- With WASM: Full integration testing
- Without WASM: Mock interface testing
- Benefits: CI/CD friendly, fast execution, contract validation
Test Development
Adding New Tests
- Unit Tests: Add to appropriate
unit/*.test.cjsfile - Integration Tests: Create new file in
integration/ - Performance Tests: Add to
performance/benchmark.test.cjs
Test Structure
const runner = new TestRunner();
runner.test('Test description', async () => {
// Test implementation
assert.ok(condition, 'Error message');
});
runner.run().then(success => {
process.exit(success ? 0 : 1);
});
Continuous Integration
GitHub Actions Example
name: Tests
on: [push, pull_request]
jobs:
test:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
- uses: actions/setup-node@v3
with:
node-version: '18'
- run: npm install
- run: node tests/run_all.cjs --report
- uses: actions/upload-artifact@v3
with:
name: test-reports
path: |
test_report.json
TEST_REPORT.md
benchmark_report.json
Troubleshooting
Common Issues
-
ES Module Errors
- Tests use
.cjsextension for CommonJS compatibility - Project uses ES modules (
"type": "module"in package.json)
- Tests use
-
WASM Not Built
- WASM tests will run with mock implementations
- Build WASM for full testing capabilities
-
Missing Dependencies
- Run
npm installto install required packages - Check Node.js version (16+ required)
- Run
Debug Mode
# Run with debug output
node tests/run_all.cjs --verbose
# Run individual test with stack traces
node tests/unit/matrix.test.cjs --verbose
Performance Benchmarking
The benchmark suite validates:
- Algorithm correctness against known solutions
- Convergence rate analysis
- Memory usage patterns
- Scaling behavior
- Numerical stability
Benchmark Metrics
- Execution time
- Memory usage
- Iteration counts
- Convergence rates
- Error rates
Contributing
When adding new functionality:
- Write tests first (TDD approach)
- Ensure both mock and real implementations work
- Add performance benchmarks for algorithms
- Update test documentation
- Run full test suite before committing
Support
For test-related issues:
- Check this README
- Review test output and error messages
- Run with
--verbosefor detailed diagnostics - Check the generated test reports
Framework Version: 1.0.0 Last Updated: 2025-09-19 Compatibility: Node.js 16+, CommonJS/ES Module hybrid