Sprint 283: poly-pipeline (steps 1943–1947)
PipelineStageSpec/Registry, PipelineGraph (Kahn topo sort), PipelineExecutionPlan, PipelineParityValidator — 26/26 tests pass. Integration step 1947: Python→Rust→Go→Haskell→TypeScript pipeline verified. Metrics: 7 whetstone calls, 8566 tokens. Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
This commit is contained in:
86
editor/tests/step1943_test.cpp
Normal file
86
editor/tests/step1943_test.cpp
Normal file
@@ -0,0 +1,86 @@
|
||||
// Step 1943: PipelineStageSpec + PipelineStageRegistry
|
||||
//
|
||||
// t1: registerStage and hasStage/stageCount
|
||||
// t2: getStage returns correct spec; throws for unknown
|
||||
// t3: stageIds returns all registered ids
|
||||
// t4: stagesForLanguage filters correctly
|
||||
// t5: re-registering same id overwrites
|
||||
|
||||
#include "PipelineStageSpec.h"
|
||||
#include <iostream>
|
||||
#include <stdexcept>
|
||||
|
||||
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(registerStage_and_metadata);
|
||||
ws::PipelineStageRegistry r;
|
||||
r.registerStage({"ingest","Python","CSV ingestion","csv","records"});
|
||||
r.registerStage({"normalize","Rust","Normalization","records","normalized"});
|
||||
C(r.stageCount() == 2, "two stages");
|
||||
C(r.hasStage("ingest"), "has ingest");
|
||||
C(r.hasStage("normalize"), "has normalize");
|
||||
C(!r.hasStage("unknown"), "no unknown");
|
||||
P();
|
||||
}
|
||||
|
||||
void t2(){
|
||||
T(getStage_correct_and_throws);
|
||||
ws::PipelineStageRegistry r;
|
||||
r.registerStage({"ingest","Python","CSV","csv","records"});
|
||||
auto s = r.getStage("ingest");
|
||||
C(s.stageId == "ingest", "stageId");
|
||||
C(s.language == "Python", "language");
|
||||
C(s.inputType == "csv", "inputType");
|
||||
bool threw = false;
|
||||
try { r.getStage("missing"); } catch (const std::out_of_range&) { threw = true; }
|
||||
C(threw, "throws for missing");
|
||||
P();
|
||||
}
|
||||
|
||||
void t3(){
|
||||
T(stageIds_returns_all);
|
||||
ws::PipelineStageRegistry r;
|
||||
r.registerStage({"a","Python","","",""});
|
||||
r.registerStage({"b","Rust","","",""});
|
||||
r.registerStage({"c","Go","","",""});
|
||||
auto ids = r.stageIds();
|
||||
C(ids.size() == 3, "three ids");
|
||||
P();
|
||||
}
|
||||
|
||||
void t4(){
|
||||
T(stagesForLanguage_filters);
|
||||
ws::PipelineStageRegistry r;
|
||||
r.registerStage({"ingest", "Python","","",""});
|
||||
r.registerStage({"validate","Python","","",""});
|
||||
r.registerStage({"norm", "Rust", "","",""});
|
||||
auto pyStages = r.stagesForLanguage("Python");
|
||||
C(pyStages.size() == 2, "two Python stages");
|
||||
C(r.stagesForLanguage("Rust").size()==1,"one Rust stage");
|
||||
C(r.stagesForLanguage("Go").empty(), "no Go stages");
|
||||
P();
|
||||
}
|
||||
|
||||
void t5(){
|
||||
T(re_register_overwrites);
|
||||
ws::PipelineStageRegistry r;
|
||||
r.registerStage({"s","Python","old","","old_out"});
|
||||
r.registerStage({"s","Rust", "new","","new_out"});
|
||||
C(r.stageCount() == 1, "still one stage");
|
||||
C(r.getStage("s").language == "Rust", "overwritten to Rust");
|
||||
C(r.getStage("s").outputType == "new_out","overwritten outputType");
|
||||
P();
|
||||
}
|
||||
|
||||
int main(){
|
||||
std::cout << "Step 1943: PipelineStageSpec + PipelineStageRegistry\n";
|
||||
t1(); t2(); t3(); t4(); t5();
|
||||
std::cout << "\n" << p << "/" << (p+f) << " passed\n";
|
||||
return f > 0 ? 1 : 0;
|
||||
}
|
||||
Reference in New Issue
Block a user