(vibe) Added testframework

This commit is contained in:
douwe
2026-03-19 08:44:01 +01:00
parent 49f253a546
commit 50cd7c10ce
15 changed files with 772 additions and 4 deletions

View File

@@ -12,3 +12,35 @@ module.exports.loop = function () {
if (mod !== undefined)
mod.loop();
}
// Expose runTests function for console testing
module.exports.runTests = function () {
if (mod !== undefined && typeof mod.runTests === 'function') {
console.log("Running Douwco Hivemind tests...");
mod.runTests();
// Get and display test results
try {
const results = mod.getTestResults();
const passed = mod.getPassedCount();
const failed = mod.getFailedCount();
const total = mod.getTotalCount();
console.log(results);
console.log(`Test Summary: ${passed}/${total} passed, ${failed} failed`);
return `Tests completed: ${passed} passed, ${failed} failed`;
} catch (e) {
console.log("Tests completed. Could not retrieve detailed results:", e.message);
return "Tests completed. Check console for basic output.";
}
} else {
console.log("ERROR: runTests function not available in WASM module");
return "ERROR: Testing framework not available";
}
}
// Also expose globally for direct console access
if (typeof global !== 'undefined') {
global.runTests = module.exports.runTests;
}