Repository navigation
8 1 regression and battletest suites
Source: https://deepwiki.com/PonvasanthPon/TransCompilator/8-1-regression-and-battletest-suites
Relevant source files
The following files were used as context for generating this wiki page:
- crates/tc-cli/tests/battletest_p5_regressions.rs
- crates/tc-cli/tests/casual_english_and_guards.rs
- crates/tc-cli/tests/discourse_synthesis.rs
- crates/tc-cli/tests/human_english_battletest.rs
- crates/tc-cli/tests/natural_collatz_flow.rs
- crates/tc-semantics/tests/battletest_conv_regressions.rs
- crates/tc-semantics/tests/battletest_p5_regressions.rs
- crates/tc-semantics/tests/orthogonality_audit.rs
- crates/tc-semantics/tests/phase3_english_parity.rs
- crates/tc-semantics/tests/phase4_7_pure_english_polish.rs
- crates/tc-semantics/tests/semantic_frame_and_lexicon_expansion.rs
This page details the verification infrastructure and test suites backing TransCompilator (tc_r1). Because TransCompilator is a deterministic, zero-ML compiler, correctness is enforced through rigorous differential testing, end-to-end interpreter-versus-ELF64 parity checks, human-English battle-test corpora, discourse synthesis suites, and programmatic orthogonality audits. Every test suite runs against both the tc_ir reference interpreter and native static x86_64 ELF binaries via tc_editor::runner::run_elf_with_parity to guarantee exact behavioral match across backends.
Sources: [crates/tc-semantics/tests/battletest_conv_regressions.rs:1-20], [crates/tc-cli/tests/human_english_battletest.rs:1-18]
The convergence suite (battletest_conv_regressions.rs) and Phase 5 regression suite (battletest_p5_regressions.rs) capture edge cases discovered during long-running compilation campaigns. They assert correct handling of chained mutations, referent sharing, and data structure scaling.
Key functional patterns tested include:
-
Compound Put/Set Chains: Expressions like
Put 100 in cash, add 50 to it, remove 20 from it, and say itverify that the implicit anaphoritcorrectly propagates through multi-clause assignment sequences[crates/tc-semantics/tests/battletest_conv_regressions.rs:6-20],[crates/tc-semantics/tests/battletest_conv_regressions.rs:84-98]. -
Output Synonym Resolution:
Show,Print,Display, andSayacross integers, floats, booleans, and memory addresses[crates/tc-semantics/tests/battletest_conv_regressions.rs:46-82]. -
Nesting and Parsing Limits: Deeply nested parentheses (e.g., 150 levels of recursion) verify that parser protection triggers clean structured diagnostics rather than stack overflows
[crates/tc-semantics/tests/battletest_conv_regressions.rs:158-173]. -
Map and List Capacity Scaling: Tests like
int_map_grows_beyond_256_entriesandtext_map_grows_beyond_256_entriesensure dynamic hash maps and vector storage resize correctly without memory leaks under heavy allocation[crates/tc-semantics/tests/battletest_p5_regressions.rs:47-106].
graph TD
TestFile["battletest_conv_regressions.rs"] --> Runner["tc_editor::runner::run_elf_with_parity"]
Runner --> Compiler["tc_semantics::compile_english_to_ir"]
Compiler --> IR["tc_ir (Reference Interpreter)"]
Compiler --> ELF["tc_codegen_x86 (Native ELF64)"]
IR --> ParityCheck["Byte-Level & Output Parity Assertion"]
ELF --> ParityCheck
Sources: [crates/tc-semantics/tests/battletest_conv_regressions.rs:1-174], [crates/tc-semantics/tests/battletest_p5_regressions.rs:1-106]
The massive human-English test corpus (human_english_battletest.rs) exercises thousands of conversational, idiom-heavy, and LLM-generated phrasing variants across multiple difficulty bands. These tests validate robust linguistic tolerance, ensuring that colloquial contractions (isn't, doesn't, it's), syntactic sugar (Start by setting, At the end, Once everything is finished), and complex multi-step procedural logic compile and execute successfully.
graph TD
NLSpace["Natural Language Space: Human/LLM English Input"] --> Tokenizer["tc_syntax::tokenize"]
Tokenizer --> Parser["tc_semantics::LinkGrammarParser"]
Parser --> AST["Typed AST & Clause Graphs"]
AST --> IRGen["Core-7 IR Generation"]
IRGen --> CodeSpace["Code Entity Space: Stmt / BasicBlock / ELF64"]
Sources: [crates/tc-cli/tests/human_english_battletest.rs:1-213]
Discourse-level regressions (discourse_synthesis.rs and natural_collatz_flow.rs) verify paragraph-scoped constructs, looping constructs, and anaphoric resolution across multi-sentence contexts.
Important constructs validated:
-
Prime and Composite Finders: Four-sentence and multi-sentence prime number searches (
Look at every number from 2 up to 50...) test nested iterations, divisibility checks, and implicit counter binding[crates/tc-cli/tests/discourse_synthesis.rs:72-94]. -
Ellipsis and Anaphora Binding: Sentences starting with
If none of them do...orIf any of them do...link back to precedingcheck whetherscopes, raising cleanUNRESOLVED_ANAPHORdiagnostics if the antecedent is missing[crates/tc-cli/tests/discourse_synthesis.rs:145-150]. -
Complex Loop Iterations: Natural Collatz sequence generation (
Repeat while current is greater than 1...) verifies 113+ line output traces and accurate arithmetic reductions[crates/tc-cli/tests/natural_collatz_flow.rs:12-24],[crates/tc-cli/tests/natural_collatz_flow.rs:80-93].
Sources: [crates/tc-cli/tests/discourse_synthesis.rs:1-210], [crates/tc-cli/tests/natural_collatz_flow.rs:1-250]
The casual English suite (casual_english_and_guards.rs) and lexicon expansion tests (semantic_frame_and_lexicon_expansion.rs) confirm vocabulary completeness for verb primitives (Increment, Decrement, Reset, Clear, Swap, Exchange, Copy, Duplicate, Square, Cube, Double, Halve, Negate) and conversational idioms (Show me x, Tell me x, Print out x, Echo 10) [crates/tc-cli/tests/casual_english_and_guards.rs:74-132], [crates/tc-semantics/tests/semantic_frame_and_lexicon_expansion.rs:45-224].
Typo guards and lint checks ensure that malformed syntax like orphan Otherwise clauses or empty loop bodies are caught at compile time with descriptive error messages pointing to exact source spans [crates/tc-cli/tests/casual_english_and_guards.rs:236-242], [crates/tc-cli/tests/discourse_synthesis.rs:153-158].
Sources: [crates/tc-cli/tests/casual_english_and_guards.rs:1-255], [crates/tc-semantics/tests/semantic_frame_and_lexicon_expansion.rs:1-316]
To prove that the compiler's semantic lowering rules do not suffer from combinatorial blind spots, orthogonality_audit.rs executes a programmatic Cartesian product test over three dimensions:
-
Statements (17 variants):
Let,Put,Set,Store,Keep,Make,Becomes,Add,Remove,Transfer,Update,Output,Increment,Decrement,Reset,Copy,Swap[crates/tc-semantics/tests/orthogonality_audit.rs:91-110]. -
Targets (7 variants):
Target::Scalar,Target::MultiWord,Target::It,Target::ValueField,Target::PointerField,Target::ItsField,Target::DefiniteField[crates/tc-semantics/tests/orthogonality_audit.rs:112-131]. -
Scopes (7 variants):
Scope::Top,Scope::Function,Scope::If,Scope::Else,Scope::While,Scope::Until,Scope::ForEvery[crates/tc-semantics/tests/orthogonality_audit.rs:133-152].
graph TD
Audit["orthogonality_audit.rs"] --> StmtIter["Statement Enum (17 kinds)"]
Audit --> TargetIter["Target Enum (7 kinds)"]
Audit --> ScopeIter["Scope Enum (7 kinds)"]
StmtIter --> Combos["Cartesian Product Generation"]
TargetIter --> Combos
ScopeIter --> Combos
Combos --> CompilerPipeline["compile_english_to_ir"]
CompilerPipeline --> ExecAudit["run_elf_with_parity"]
Sources: [crates/tc-semantics/tests/orthogonality_audit.rs:1-425]
The TransCompilator Project