Final Phase 5 sprint: unified polyglot orchestration over 8 languages (C++, Python, Rust, Go, Haskell, TypeScript, Java, Lisp) Components: - PolyglotFunctionMap: (language, functionName) → implementation tag registry - PolyglotExecutionContext: per-language runtime config (timeout_ms/env/working_dir) - PolyglotResultAggregator: FunctionResult collection + AggregateReport (pass/fail/duration) - PolyglotOrchestrator: ties all three; recordResult; runSummary 26/26 tests pass. Phase 5 (The Proof) complete. Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
97 lines
2.9 KiB
C++
97 lines
2.9 KiB
C++
// Step 1957: Sprint 285 Integration — poly-everything
|
||
//
|
||
// 8 languages: C++, Python, Rust, Go, Haskell, TypeScript, Java, Lisp
|
||
// One function per language, all results recorded.
|
||
//
|
||
// t1: 8 functions registered across 8 languages
|
||
// t2: all 8 results recorded; report shows totalCount=8
|
||
// t3: aggregateReport all pass (8 passes, 0 failures)
|
||
// t4: totalDurationMs sums across all 8
|
||
// t5: Sprint285IntegrationSummary reports 5 steps
|
||
|
||
#include "PolyglotOrchestrator.h"
|
||
#include "Sprint285IntegrationSummary.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;}
|
||
|
||
static const std::vector<std::string> LANGS = {
|
||
"C++", "Python", "Rust", "Go", "Haskell", "TypeScript", "Java", "Lisp"
|
||
};
|
||
|
||
static ws::PolyglotOrchestrator makeOrchestrator() {
|
||
ws::PolyglotOrchestrator o;
|
||
for (const auto& lang : LANGS) {
|
||
o.addFunction(lang, "run", lang + "::run_v1");
|
||
ws::LanguageConfig cfg;
|
||
cfg.timeout_ms = 5000;
|
||
cfg.working_dir = "/work/" + lang;
|
||
o.setContext(lang, cfg);
|
||
}
|
||
return o;
|
||
}
|
||
|
||
void t1(){
|
||
T(eight_functions_registered);
|
||
auto o = makeOrchestrator();
|
||
auto registered = o.functionMap().registeredLanguages();
|
||
C(registered.size() == 8, "eight languages");
|
||
for (const auto& lang : LANGS)
|
||
C(o.functionMap().hasFunction(lang, "run"), lang + " run registered");
|
||
P();
|
||
}
|
||
|
||
void t2(){
|
||
T(all_8_results_recorded_totalCount_8);
|
||
auto o = makeOrchestrator();
|
||
int dur = 100;
|
||
for (const auto& lang : LANGS)
|
||
o.recordResult({lang, "run", "output\n", true, dur += 10});
|
||
auto report = o.resultAggregator().aggregateReport();
|
||
C(report.totalCount == 8, "totalCount 8");
|
||
P();
|
||
}
|
||
|
||
void t3(){
|
||
T(aggregateReport_all_8_pass);
|
||
auto o = makeOrchestrator();
|
||
for (const auto& lang : LANGS)
|
||
o.recordResult({lang, "run", "ok\n", true, 100});
|
||
auto s = o.runSummary();
|
||
C(s.passCount == 8, "passCount 8");
|
||
C(s.failCount == 0, "failCount 0");
|
||
C(s.allPassed, "allPassed");
|
||
P();
|
||
}
|
||
|
||
void t4(){
|
||
T(totalDurationMs_sums_all_8);
|
||
auto o = makeOrchestrator();
|
||
for (const auto& lang : LANGS)
|
||
o.recordResult({lang, "run", "ok\n", true, 50});
|
||
auto report = o.resultAggregator().aggregateReport();
|
||
C(report.totalDurationMs == 400, "totalDurationMs 400 (8 × 50)");
|
||
P();
|
||
}
|
||
|
||
void t5(){
|
||
T(sprint285_integration_summary);
|
||
ws::Sprint285IntegrationSummary s;
|
||
C(s.stepsCompleted == 5, "5 steps");
|
||
C(s.success, "success");
|
||
C(s.sprintName() == "Sprint 285: poly-everything", "name");
|
||
P();
|
||
}
|
||
|
||
int main(){
|
||
std::cout << "Step 1957: Sprint 285 Integration\n";
|
||
t1(); t2(); t3(); t4(); t5();
|
||
std::cout << "\n" << p << "/" << (p+f) << " passed\n";
|
||
return f > 0 ? 1 : 0;
|
||
}
|