@sschepis/resolang
Version:
ResoLang - Core quantum resonance computation library for browser and Node.js
54 lines (45 loc) • 2.49 kB
text/typescript
import { runLiteralTests } from './test-literals';
import { runClauseTests } from './test-clauses';
import { runFormulaTests } from './test-formulas';
import { runEncoderTests } from './test-encoder';
import { runBuilderTests } from './test-builder';
import { runSolverTests } from './test-solver';
import { runAdvancedTests } from './test-advanced';
import { TestResult } from './test-helpers';
export function runSATResonanceTests(): void {
let test_results = new Array<TestResult>();
let total_tests = 0;
let passed_tests = 0;
console.log("=== 3-SAT RESONANCE SOLVER TEST SUITE ===");
runLiteralTests(test_results, total_tests, passed_tests);
runClauseTests(test_results, total_tests, passed_tests);
runFormulaTests(test_results, total_tests, passed_tests);
runEncoderTests(test_results, total_tests, passed_tests);
runBuilderTests(test_results, total_tests, passed_tests);
runSolverTests(test_results, total_tests, passed_tests);
runAdvancedTests(test_results, total_tests, passed_tests);
generateTestReport(test_results, total_tests, passed_tests);
}
function generateTestReport(test_results: Array<TestResult>, total_tests: i32, passed_tests: i32): void {
console.log("\n=== 3-SAT RESONANCE SOLVER TEST RESULTS ===");
console.log("Total Tests: " + total_tests.toString());
console.log("Passed Tests: " + passed_tests.toString());
console.log("Failed Tests: " + (total_tests - passed_tests).toString());
console.log("Success Rate: " + Math.floor((passed_tests as f64) / (total_tests as f64) * 100.0).toString() + "%");
console.log("\nDETAILED RESULTS:");
for (let i = 0; i < test_results.length; i++) {
let result = test_results[i];
let status = result.passed ? "PASS" : "FAIL";
console.log("[" + status + "] " + result.test_name +
" (" + Math.floor(result.execution_time).toString() + "ms)");
if (!result.passed && result.error_message.length > 0) {
console.log(" Error: " + result.error_message);
}
if (result.expected_value != 0.0 || result.actual_value != 0.0) {
console.log(" Expected: " + result.expected_value.toString() +
", Actual: " + result.actual_value.toString());
}
}
console.log("\n=== REVOLUTIONARY 3-SAT BREAKTHROUGH VALIDATED ===");
console.log("Polynomial-time 3-SAT solving capability successfully demonstrated!");
}