Step 102: memory strategy dashboard

This commit is contained in:
Bill
2026-02-09 10:41:54 -07:00
parent 7738c3d6b4
commit 60ae9e2d70
5 changed files with 182 additions and 0 deletions

View File

@@ -0,0 +1,37 @@
// Step 102 TDD Test: Memory strategy dashboard helpers
//
// Tests:
// 1. Collect annotation entries and build JSON
#include <cassert>
#include <iostream>
#include "StrategyDashboard.h"
#include "ast/Module.h"
#include "ast/Function.h"
#include "ast/Annotation.h"
int main() {
int passed = 0;
int failed = 0;
Module* mod = new Module("m1", "mod", "cpp");
mod->setSpan(0, 0, 5, 0);
auto* fn = new Function("f1", "foo");
fn->setSpan(1, 0, 3, 0);
mod->addChild("functions", fn);
auto* anno = new LifetimeAnnotation("a1", "RAII");
fn->addChild("annotations", anno);
std::vector<AnnotationEntry> entries;
collectAnnotationEntries(mod, entries);
assert(entries.size() == 1);
auto j = buildAnnotationSummaryJson(entries);
assert(j.contains("annotations"));
assert(j["annotations"].size() == 1);
std::cout << "Test 1 PASS: dashboard helpers" << std::endl;
++passed;
std::cout << "\n=== Step 102 Results: " << passed << " passed, " << failed << " failed ===" << std::endl;
return failed > 0 ? 1 : 0;
}