Abstract
While Large Language Models (LLMs) have demonstrated remarkable proficiency in code generation, their ability to rigorously test complex algorithms remains under-explored. This paper introduces TestCase-Eval, a benchmark designed to evaluate LLMs on two critical dimensions: Fault Coverage and Fault Exposure. Our findings reveal a significant performance gap between AI and human experts. While top-tier competitive programmers achieve a 93.3% success rate in "hacking" buggy code, the best-performing LLM reaches only 43.8%, underscoring the ongoing challenge of generating effective edge cases for algorithmic problems.
Introduction: The Challenge of Algorithmic Testing
In software engineering, the robustness of a test suite is defined by its ability to detect bugs. Traditional metrics like line and branch coverage often fail to capture the nuances of algorithmic correctness. In competitive programming, a solution might execute every line of code yet still fail due to subtle logical errors or resource inefficiencies, such as Time Limit Exceeded (TLE) or Memory Limit Exceeded (MLE) errors. TestCase-Eval addresses this by shifting the focus from code execution to outcome-oriented metrics: Fault Coverage (detecting diverse bugs) and Fault Exposure (crafting targeted inputs to break specific buggy code).
The TestCase-Eval Framework
The researchers developed a systematic evaluation pipeline to move beyond simple coverage metrics. The framework focuses on two primary tasks:
- Fault Coverage (Task 1): Generating a set of test cases to catch as many incorrect human-written solutions as possible for a given problem.
- Fault Exposure (Task 2): Generating a single, targeted input designed to cause a specific piece of buggy code to fail.
Evaluation is conducted within a secure sandbox (ExecEval), comparing generated outputs against correct solutions. The study also explores the impact of prompting strategies, specifically comparing Direct Output with Chain-of-Thought (CoT) reasoning, where the model explains its logic before providing the test case.
The TestCase-Eval Benchmark
The benchmark is built upon a robust dataset designed to minimize data leakage and ensure a rigorous evaluation:
- 500 Algorithm Problems: Sourced from 2024 Codeforces contests to ensure models haven't seen them during training.
- 100,000 Human Solutions: A massive collection of both correct and incorrect submissions in C++, Python, and Java.
- Difficulty Stratification: Incorrect solutions are categorized as Easy, Medium, or Hard based on their original failure points in competition.
Key Insights
- Coverage vs. Fault Detection: High line coverage does not equate to high bug detection. Models that achieve 90% coverage on older benchmarks often struggle with the fault-based tasks in TestCase-Eval.
- The Power of Reasoning: Models optimized for reasoning, such as the Qwen series and DeepSeek-R1-Distill, significantly outperform general-purpose models. This suggests that "thinking" through the logic of a problem is essential for identifying edge cases.
- Language-Specific Performance: Models tend to be more successful at exposing faults in Python code, likely due to its dynamic nature and flexible syntax compared to the strict typing of C++ or Java.
- Resource Complexity: LLMs struggle to identify performance-related bugs (TLE/MLE). They are far more effective at finding logical "Wrong Answer" (WA) errors than understanding the computational complexity required to trigger resource limits.
Experimental Results
The results highlight a stark divide between human expertise and current AI capabilities. Human experts achieved a 93.3% fault exposure rate, whereas the top-performing model, Qwen3-32B, reached only 43.8%.
As shown in the evaluation data, proprietary models like GPT-4.1 also struggle significantly compared to human experts, particularly as problem difficulty increases. Furthermore, the study confirmed that Chain-of-Thought (CoT) prompting is essential for high-quality test generation. Interestingly, leading open-source models like Llama-3.1-70B are now competitive with or even superior to proprietary giants in fault coverage tasks.
Limitations and Future Directions
While TestCase-Eval provides a rigorous new standard, several limitations remain:
- Qualitative Analysis: Current evaluation is binary (pass/fail); future work should investigate the qualitative reasons why certain bugs are missed.
- Complexity Reasoning: Improving model understanding of algorithmic complexity is necessary to better target TLE and MLE errors.
- Holistic Workflow: Future iterations could expand to include fault localization and automated debugging to provide a more complete testing solution.
Summary updated