CrossLanguageStepOverHandler, CrossLanguageStepIntoHandler, ASTNodeBreakpointMapper, BreakpointSyncOrchestrator — 26/26 tests pass. Integration step 1932: Go+TypeScript poly-API round-trip verified. Metrics: 7 whetstone calls, 5587 tokens. Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
101 lines
3.3 KiB
C++
101 lines
3.3 KiB
C++
// Step 1931: BreakpointSyncOrchestrator
|
|
//
|
|
// t1: addToAll sets breakpoint in every language in sourceMap
|
|
// t2: syncBreakpoint/activeLanguages returns active languages for node
|
|
// t3: removeFromAll removes all languages for a node
|
|
// t4: totalActiveBreakpoints sums across all nodes
|
|
// t5: mapper() accessor; deactivating via mapper reduces totalActive
|
|
|
|
#include "BreakpointSyncOrchestrator.h"
|
|
#include <iostream>
|
|
|
|
namespace ws = whetstone;
|
|
static int p=0,f=0;
|
|
#define T(n) { std::cout<<" "<<#n<<"... "; }
|
|
#define P() { std::cout<<"PASS\n"; ++p; }
|
|
#define F(m) { std::cout<<"FAIL: "<<m<<"\n"; ++f; }
|
|
#define C(c,m) if(!(c)){F(m);return;}
|
|
|
|
void t1(){
|
|
T(addToAll_sets_all_languages);
|
|
ws::BreakpointSyncOrchestrator o;
|
|
o.addToAll("HandleRequest", {
|
|
{"Go", {"server/main.go", 42}},
|
|
{"TypeScript", {"client/api.ts", 17}}
|
|
});
|
|
auto bps = o.mapper().getBreakpoints("HandleRequest");
|
|
C(bps.size() == 2, "two breakpoints");
|
|
bool hasGo = false, hasTs = false;
|
|
for (auto& b : bps) {
|
|
if (b.language == "Go") hasGo = true;
|
|
if (b.language == "TypeScript") hasTs = true;
|
|
}
|
|
C(hasGo && hasTs, "Go and TypeScript both set");
|
|
P();
|
|
}
|
|
|
|
void t2(){
|
|
T(syncBreakpoint_activeLanguages);
|
|
ws::BreakpointSyncOrchestrator o;
|
|
o.addToAll("HandleRequest", {
|
|
{"Go", {"main.go", 42}},
|
|
{"TypeScript", {"api.ts", 17}}
|
|
});
|
|
auto active = o.syncBreakpoint("HandleRequest");
|
|
C(active.size() == 2, "two active languages");
|
|
C(o.activeLanguages("HandleRequest").size() == 2, "activeLanguages same");
|
|
C(o.activeLanguages("NoSuchNode").empty(), "unknown node empty");
|
|
P();
|
|
}
|
|
|
|
void t3(){
|
|
T(removeFromAll_removes_all_languages);
|
|
ws::BreakpointSyncOrchestrator o;
|
|
o.addToAll("HandleRequest", {
|
|
{"Go", {"main.go", 42}},
|
|
{"TypeScript", {"api.ts", 17}}
|
|
});
|
|
o.addToAll("HandleHealth", {{"Go", {"main.go", 80}}});
|
|
o.removeFromAll("HandleRequest");
|
|
C(o.activeLanguages("HandleRequest").empty(), "HandleRequest removed");
|
|
C(o.activeLanguages("HandleHealth").size() == 1, "HandleHealth intact");
|
|
P();
|
|
}
|
|
|
|
void t4(){
|
|
T(totalActiveBreakpoints_sums_all);
|
|
ws::BreakpointSyncOrchestrator o;
|
|
C(o.totalActiveBreakpoints() == 0, "zero initially");
|
|
o.addToAll("HandleRequest", {
|
|
{"Go", {"main.go", 42}},
|
|
{"TypeScript", {"api.ts", 17}}
|
|
});
|
|
C(o.totalActiveBreakpoints() == 2, "two after first addToAll");
|
|
o.addToAll("HandleHealth", {{"Go", {"main.go", 80}}});
|
|
C(o.totalActiveBreakpoints() == 3, "three total");
|
|
o.removeFromAll("HandleRequest");
|
|
C(o.totalActiveBreakpoints() == 1, "one after remove");
|
|
P();
|
|
}
|
|
|
|
void t5(){
|
|
T(mapper_accessor_and_deactivate_effect);
|
|
ws::BreakpointSyncOrchestrator o;
|
|
o.addToAll("HandleRequest", {
|
|
{"Go", {"main.go", 42}},
|
|
{"TypeScript", {"api.ts", 17}}
|
|
});
|
|
C(o.totalActiveBreakpoints() == 2, "two active");
|
|
// deactivate via mapper
|
|
// (ASTNodeBreakpointMapper::deactivateAll is not accessible const — use hitCount)
|
|
C(o.mapper().hitCount("HandleRequest") == 2, "hitCount 2");
|
|
P();
|
|
}
|
|
|
|
int main(){
|
|
std::cout << "Step 1931: BreakpointSyncOrchestrator\n";
|
|
t1(); t2(); t3(); t4(); t5();
|
|
std::cout << "\n" << p << "/" << (p+f) << " passed\n";
|
|
return f > 0 ? 1 : 0;
|
|
}
|