// Step 1967: Sprint 287 Integration // // t1: all 8 tasks produce correct library selection // t2: verifyAllSelections() passes // t3: avoidedLibraries present for tasks with multiple candidates // t4: tasks with single qualified library have no avoided entries // t5: Sprint287IntegrationSummary metadata correct #include "Sprint287IntegrationSummary.h" #include 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(all_8_tasks_correct_library); auto ledger = ws::Sprint286IntegrationSummary::buildSeedLedger(); ws::PerTaskLibrarySelector sel; auto tasks = ws::Sprint287IntegrationSummary::buildTaskSpec(); C(tasks.size() == 8, "8 tasks"); for (const auto& task : tasks) { auto r = sel.select(task.operationDomain, task.availableLibraries, ledger); C(r.selectedLibrary == task.expectedLibrary, task.taskId + ": expected " + task.expectedLibrary + " got " + r.selectedLibrary); } P(); } void t2() { T(verifyAllSelections_passes); C(ws::Sprint287IntegrationSummary::verifyAllSelections(), "verifyAllSelections true"); P(); } void t3() { T(avoided_libraries_present_for_multi_candidate_tasks); auto ledger = ws::Sprint286IntegrationSummary::buildSeedLedger(); ws::PerTaskLibrarySelector sel; // t1: nlohmann vs protobuf -> 1 avoided auto r1 = sel.select("serialization.json", {"nlohmann_json", "protobuf"}, ledger); C(!r1.avoidedLibraries.empty(), "t1 has avoided"); C(r1.avoidedLibraries[0].name == "protobuf", "t1 avoided is protobuf"); // t5: tokio vs boost.asio -> 1 avoided auto r5 = sel.select("network.async", {"tokio", "boost.asio"}, ledger); C(!r5.avoidedLibraries.empty(), "t5 has avoided"); C(r5.avoidedLibraries[0].name == "boost.asio", "t5 avoided is boost.asio"); P(); } void t4() { T(single_qualified_has_no_avoided); auto ledger = ws::Sprint286IntegrationSummary::buildSeedLedger(); ws::PerTaskLibrarySelector sel; // t4: only numpy for compute.statistics auto r4 = sel.select("compute.statistics", {"numpy"}, ledger); C(r4.selectedLibrary == "numpy", "numpy selected"); C(r4.avoidedLibraries.empty(), "no avoided for t4"); // t6: only thrust for compute.parallel auto r6 = sel.select("compute.parallel", {"thrust"}, ledger); C(r6.selectedLibrary == "thrust", "thrust selected"); C(r6.avoidedLibraries.empty(), "no avoided for t6"); P(); } void t5() { T(sprint287_metadata); ws::Sprint287IntegrationSummary s; C(s.stepsCompleted == 5, "5 steps"); C(s.success, "success"); C(s.sprintName() == "Sprint 287: PerTaskLibrarySelector", "name"); P(); } int main() { std::cout << "Step 1967: Sprint 287 Integration\n"; t1(); t2(); t3(); t4(); t5(); std::cout << "\n" << p << "/" << (p + f) << " passed\n"; return f > 0 ? 1 : 0; }