[2602.16671] SPARC: Scenario Planning and Reasoning for Automated C Unit Test Generation
Summary
The SPARC framework enhances automated C unit test generation by bridging the gap between program intent and syntactic constraints, improving test coverage and maintainability.
Why It Matters
Automated unit testing is crucial for software reliability, especially in C programming, where manual memory management poses challenges. SPARC's innovative approach could significantly improve testing efficiency and accuracy, making it relevant for software engineers and developers working with legacy codebases.
Key Takeaways
- SPARC integrates scenario-based reasoning with LLMs to improve unit test generation.
- It outperforms traditional methods in line coverage, branch coverage, and mutation score.
- The framework includes a self-correction loop that enhances test quality over time.
- SPARC is particularly effective for complex C codebases, improving readability and maintainability.
- This approach aligns AI reasoning with program structures, offering a scalable solution for testing.
Computer Science > Software Engineering arXiv:2602.16671 (cs) [Submitted on 18 Feb 2026] Title:SPARC: Scenario Planning and Reasoning for Automated C Unit Test Generation Authors:Jaid Monwar Chowdhury, Chi-An Fu, Reyhaneh Jabbarvand View a PDF of the paper titled SPARC: Scenario Planning and Reasoning for Automated C Unit Test Generation, by Jaid Monwar Chowdhury and 2 other authors View PDF HTML (experimental) Abstract:Automated unit test generation for C remains a formidable challenge due to the semantic gap between high-level program intent and the rigid syntactic constraints of pointer arithmetic and manual memory management. While Large Language Models (LLMs) exhibit strong generative capabilities, direct intent-to-code synthesis frequently suffers from the leap-to-code failure mode, where models prematurely emit code without grounding in program structure, constraints, and semantics. This will result in non-compilable tests, hallucinated function signatures, low branch coverage, and semantically irrelevant assertions that cannot properly capture bugs. We introduce SPARC, a neuro-symbolic, scenario-based framework that bridges this gap through four stages: (1) Control Flow Graph (CFG) analysis, (2) an Operation Map that grounds LLM reasoning in validated utility helpers, (3) Path-targeted test synthesis, and (4) an iterative, self-correction validation loop using compiler and runtime feedback. We evaluate SPARC on 59 real-world and algorithmic subjects, where it outpe...