Files
whetstone_DSL/editor/tests/step790_test.cpp
Bill 1696b92bb8 Add Sprints 46-59: governance, porting foundation, and language graduation prep (Steps 689-828)
Sprints 46-58 implement the cross-language porting foundation: language-to-IR
adapters, equivalence checking, gate validation, legacy ingestion, managed/dynamic
families, low-level/logic-actor semantics, debug workflow tooling, AST-native
family tools, Rust/CPP raising tools, system-level orchestration, query family,
and porting gates. Sprint 59 adds the governance layer (policy packs, review
boards, waiver packets, ambiguity triage, decision ledger) with the
whetstone_review_porting_decision MCP tool.

Also includes: sprint plans 46-130, MCP taskitem pipeline scripts,
CLAUDE.md, docs, and full test matrix (steps 689-828).

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
2026-02-22 13:18:10 -07:00

20 lines
1.9 KiB
C++

// Step 790: PostgreSQL lowering/raising adapters (10 tests)
#include "data_query/PostgreSqlAdapterV1.h"
#include <iostream>
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(lang_postgresql);auto x=PostgreSqlAdapterV1::lower("SELECT 1");C(x.sourceDialect=="postgresql","dialect");P();}
void t2(){T(non_empty_ir);auto x=PostgreSqlAdapterV1::lower("SELECT 1");C(x.irSummary=="sql_query_ir_v1","ir");P();}
void t3(){T(join_detected);auto x=PostgreSqlAdapterV1::lower("SELECT * FROM a JOIN b ON a.id=b.id");C(x.hasJoin,"join");P();}
void t4(){T(aggregate_detected);auto x=PostgreSqlAdapterV1::lower("SELECT COUNT(*) FROM a");C(x.hasAggregate,"agg");P();}
void t5(){T(null_detected);auto x=PostgreSqlAdapterV1::lower("SELECT * FROM a WHERE x IS NULL");C(x.hasNullSemantics,"null");P();}
void t6(){T(raise_target);auto x=PostgreSqlAdapterV1::raise("sql_query_ir_v1","safe");C(x.targetDialect=="postgresql","target");P();}
void t7(){T(raise_profile);auto x=PostgreSqlAdapterV1::raise("sql_query_ir_v1","safe");C(x.profile=="safe","profile");P();}
void t8(){T(json_lower_shape);auto j=SqlCanonicalQueryIR::toJson(PostgreSqlAdapterV1::lower("SELECT 1"));C(j.contains("source_dialect")&&j.contains("ir_summary"),"shape");P();}
void t9(){T(json_raise_shape);auto j=SqlCanonicalQueryIR::toJson(PostgreSqlAdapterV1::raise("sql_query_ir_v1","safe"));C(j.contains("target_dialect")&&j.contains("query_preview"),"shape");P();}
void t10(){T(deterministic);auto a=SqlCanonicalQueryIR::toJson(PostgreSqlAdapterV1::lower("SELECT 1")).dump();auto b=SqlCanonicalQueryIR::toJson(PostgreSqlAdapterV1::lower("SELECT 1")).dump();C(a==b,"det");P();}
int main(){std::cout<<"Step 790: PostgreSqlAdapterV1\n";t1();t2();t3();t4();t5();t6();t7();t8();t9();t10();std::cout<<"\nResults: "<<p<<"/"<<(p+f)<<" passed\n";return f?1:0;}