SPARC: Scenario Planning and Reasoning for Automated C Unit Test Generation
On the map: LLM reasoning → Reasoning for agents, planning and code
Abstract (arXiv)
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 outperforms the vanilla prompt generation baseline by 31.36% in line coverage, 26.01% in branch coverage, and 20.78% in mutation score, matching or exceeding the symbolic execution tool KLEE on complex subjects. SPARC retains 94.3% of tests through iterative repair and produces code with significantly higher developer-rated readability and maintainability. By aligning LLM reasoning with program structure, SPARC provides a scalable path for industrial-grade testing of legacy C codebases.
Key facts. No citing papers in the map yet (data through 7 Oct 2026). Placed in Reasoning for agents, planning and code, one of 17 directions in LLM reasoning. Builds on 17 of its 35 references that are in the map. First posted on arXiv 18 Feb 2026.
Builds on
17 of 35 references.
Closest ancestors · 1
Same direction, newest first
Other references · 16
- 2023An Empirical Evaluation of Using Large Language Models for Automated Unit Test Generationcited by 193
- 2023ChatUniTest: A Framework for LLM-Based Test Generationcited by 94
- 2023No More Manual Tests? Evaluating and Improving ChatGPT for Unit Test Generationcited by 82
- 2024Automated Unit Test Improvement using Large Language Models at Metacited by 73
- 2024TestART: Improving LLM-based Unit Testing via Co-evolution of Automated Generation and Repair Iterationcited by 20
- 2025LLM Test Generation via Iterative Hybrid Program Analysiscited by 9
- 2025Test Wars: A Comparative Study of SBST, Symbolic Execution, and LLM-Based Approaches to Unit Test Generationcited by 7
- 2025ReCode: Improving LLM-based Code Repair with Fine-Grained Retrieval-Augmented Generationcited by 6
- 2025Translating Large-Scale C Repositories to Idiomatic Rustcited by 6
- 2024REACCEPT: Automated Co-evolution of Production and Test Code Based on Dynamic Validation and Large Language Modelscited by 5
- 2025CITYWALK: Enhancing LLM-Based C++ Unit Test Generation via Project-Dependency Awareness and Language-Specific Knowledgecited by 3
- 2025Knowledge Matters: Injecting Project and Testing Knowledge into LLM-based Unit Test Generationcited by 3
4 more
- 2019Mull it over: mutation testing based on LLVMcited by 2
- 2025Large Language Models for Unit Test Generation: Achievements, Challenges, and Opportunitiescited by 2
- 2026Automated Test Suite Enhancement Using Large Language Models with Few-shot Promptingcited by 2
- 2025ATLAS: Multi-View Code Representation Tool for C and C++ Source Programscited by 1
Built on by
Not cited yet.
Similar, not cited
Close in wording, no citation either way
- 2025Automated Repair of C Programs Using Large Language Models
- 2026LiveFMBench: Unveiling the Power and Limits of Agentic Workflows in Specification Generation
- 2025DISTINCT: A Description-Guided Branch-Consistency Analysis Framework for Non-Regressive Test Case Generation ↗
- 2026RM -RF: Reward Model for Run-Free Unit Test Evaluation
- 2025TestForge: Feedback-Driven, Agentic Test Suite Generation
- 2026Teaching LLMs Program Semantics via Symbolic Execution Traces
- 2025Program Synthesis via Test-Time Transduction
- 2026TDD-Agent: Test-Driven Reasoning for Code Generation