@sschepis/resolang
Version:
ResoLang - Core quantum resonance computation library
138 lines (118 loc) ⢠3.82 kB
text/typescript
// run-all-tests.ts
// Main test runner for all Prime Resonance Network tests
import { runAllCryptoUtilTests } from "./crypto-utils.test";
import { runAllKeytripletTests } from "./keytriplet.test";
import { runAllUtilsTests } from "./utils.test";
import { runAllFunctionalBlocksTests } from "./functionalBlocks.test";
// Test result tracking
class TestResult {
suite: string;
passed: boolean;
error: string | null;
constructor(suite: string, passed: boolean, error: string | null = null) {
this.suite = suite;
this.passed = passed;
this.error = error;
}
}
// Main test runner
export function runAllTests(): void {
console.log("\n");
console.log("========================================");
console.log(" PRIME RESONANCE NETWORK TEST SUITE ");
console.log("========================================");
console.log("\n");
const results: Array<TestResult> = [];
const startTime = Date.now();
// Run crypto utility tests
try {
runAllCryptoUtilTests();
results.push(new TestResult("Crypto Utilities", true));
} catch (e) {
const error = e instanceof Error ? e.message : "Unknown error";
results.push(new TestResult("Crypto Utilities", false, error));
}
// Run keytriplet tests
try {
runAllKeytripletTests();
results.push(new TestResult("Keytriplet System", true));
} catch (e) {
const error = e instanceof Error ? e.message : "Unknown error";
results.push(new TestResult("Keytriplet System", false, error));
}
// Run utils tests
try {
runAllUtilsTests();
results.push(new TestResult("Utilities", true));
} catch (e) {
const error = e instanceof Error ? e.message : "Unknown error";
results.push(new TestResult("Utilities", false, error));
}
// Run functional blocks tests
try {
runAllFunctionalBlocksTests();
results.push(new TestResult("Functional Blocks", true));
} catch (e) {
const error = e instanceof Error ? e.message : "Unknown error";
results.push(new TestResult("Functional Blocks", false, error));
}
// Calculate statistics
const endTime = Date.now();
const duration = endTime - startTime;
let passedCount = 0;
let failedCount = 0;
for (let i = 0; i < results.length; i++) {
if (results[i].passed) {
passedCount++;
} else {
failedCount++;
}
}
// Print summary
console.log("\n");
console.log("========================================");
console.log(" TEST SUMMARY ");
console.log("========================================");
console.log("\n");
console.log(`Total Test Suites: ${results.length}`);
console.log(`Passed: ${passedCount}`);
console.log(`Failed: ${failedCount}`);
console.log(`Duration: ${duration}ms`);
console.log("\n");
// Print detailed results
if (failedCount > 0) {
console.log("Failed Test Suites:");
console.log("-------------------");
for (let i = 0; i < results.length; i++) {
const result = results[i];
if (!result.passed) {
console.log(`\nā ${result.suite}`);
if (result.error) {
console.log(` Error: ${result.error}`);
}
}
}
console.log("\n");
}
// Print passed suites
console.log("Passed Test Suites:");
console.log("-------------------");
for (let i = 0; i < results.length; i++) {
const result = results[i];
if (result.passed) {
console.log(`ā
${result.suite}`);
}
}
console.log("\n");
// Final status
if (failedCount === 0) {
console.log("š ALL TESTS PASSED! š");
} else {
console.log(`ā ļø ${failedCount} TEST SUITE(S) FAILED`);
}
console.log("\n");
}
// Export for direct execution
export { runAllTests as default };
// Run tests if this is the main module
runAllTests();