Proceedings

LogiCase: Effective Test Case Generation from Logical Description in Competitive Programming

Download BibTeX Cite

Proceedings of the Thirty-Fourth International Joint Conference on Artificial Intelligence. Main Track. Pages 7742-7750.

https://doi.org/10.24963/ijcai.2025/861

Abstract

Automated Test Case Generation (ATCG) is crucial for evaluating software reliability, particularly in competitive programming where robust algorithm assessments depend on diverse and accurate test cases. However, existing ATCG methods often fail to meet complex specifications or generate effective corner cases, limiting their utility. In this work, we introduce Context-Free Grammars with Counters (CCFGs), a formalism that captures both syntactic and semantic structures in input specifications. Using a fine-tuned CodeT5 model, we translate natural language input specifications into CCFGs, enabling the systematic generation of high-quality test cases. Experiments on the CodeContests dataset demonstrate that CCFG-based test cases outperform baseline methods in identifying incorrect algorithms, achieving significant gains in validity and effectiveness. Our approach provides a scalable and reliable grammar-driven framework for enhancing automated competitive programming evaluations.

  1. [Anand et al., 2013] Saswat Anand, Edmund K. Burke, Tsong Yueh Chen, John A. Clark, Myra B. Cohen, Wolf- gang Grieskamp, Mark Harman, Mary Jean Harrold, and Phil McMinn. An orchestrated survey of methodologies for automated software test case generation. Journal of systems and software, 86(8):1978-2001, 2013.
  2. [Chen et al., 2021] Mark Chen, Jerry Tworek, Heewoo Jun, Qiming Yuan, Henrique Ponde De Oliveira Pinto, Jared Kaplan, Harri Edwards, Yuri Burda, Nicholas Joseph, Greg Brockman, et al. Evaluating large language models trained on code. CoRR, abs/2107.03374, 2021.
  3. [Chistikov et al., 2018] Dmitry Chistikov, Christoph Haase, and Simon Halfon. Context-free commutative grammars with integer counters and resets. Theoretical Computer Science, 735:147-161, 2018.
  4. [Dakhel et al., 2024] Arghavan Moradi Dakhel, Amin Nikan- jam, Vahid Majdinasab, Foutse Khomh, and Michel C. Desmarais. Effective test generation using pre-trained large language models and mutation testing. Information and Software Technology, 171:107468, 2024.
  5. [Feng et al., 2020] Zhangyin Feng, Daya Guo, Duyu Tang, Nan Duan, Xiaocheng Feng, Ming Gong, Linjun Shou, Bing Qin, Ting Liu, Daxin Jiang, and Ming Zhou. Code- BERT: A pre-trained model for programming and natural languages. In Findings of the Association for Computa- tional Linguistics, volume EMNLP 2020, pages 1536-1547. Association for Computational Linguistics, 2020.
  6. [Fraser and Arcuri, 2011] Gordon Fraser and Andrea Arcuri. EvoSuite: Automatic test suite generation for object- oriented software. In SIGSOFT/FSE'11 19th ACM SIG- SOFT Symposium on the Foundations of Software Engineer- ing and 13th European Software Engineering Conference, pages 416-419. ACM, 2011.
  7. [Godefroid et al., 2008] Patrice Godefroid, Adam Kiezun, and Michael Y. Levin. Grammar-based whitebox fuzzing. In Proceedings of the 29th ACM SIGPLAN Conference on Programming Language Design and Implementation, pages 206-215. ACM, 2008.
  8. [Guo et al., 2022] Daya Guo, Shuai Lu, Nan Duan, Yanlin Wang, Ming Zhou, and Jian Yin. UniXcoder: Unified cross- modal pre-training for code representation. In Proceedings of the 60th Annual Meeting of the Association for Com- putational Linguistics, pages 7212-7225. Association for Computational Linguistics, 2022.
  9. [Hopcroft et al., 2007] John E. Hopcroft, Rajeev Motwani, and Jeffrey D. Ullman. Introduction to automata theory, languages, and computation, 3rd Edition. Addison-Wesley, 2007. Lemieux et al., 2023]
  10. Caroline Lemieux, Jeevana Priya In- ala, Shuvendu K. Lahiri, and Siddhartha Sen. CodaMosa: Escaping coverage plateaus in test generation with pre- trained large language models. In Proceedings of the 45th International Conference on Software Engineering, pages 919-931. IEEE, 2023.
  11. [Li et al., 2022] Yujia Li, David H. Choi, Junyoung Chung, Nate Kushman, Julian Schrittwieser, Rémi Leblond, Tom Eccles, James Keeling, Felix Gimeno, Agustin Dal Lago, Thomas Hubert, Peter Choy, Cyprien de Masson d'Autume, Igor Babuschkin, Xinyun Chen, Po-Sen Huang, Johannes Welbl, Sven Gowal, Alexey Cherepanov, James Molloy, Daniel J. Mankowitz, Esme Sutherland Robson, Pushmeet Kohli, Nando de Freitas, Koray Kavukcuoglu, and Oriol Vinyals. Competition-level code generation with Alpha- Code. Science, 378:1092-1097, 2022.
  12. [Liu et al., 2023] Jiawei Liu, Chunqiu Steven Xia, Yuyao Wang, and Lingming Zhang. Is your code generated by chatgpt really correct? rigorous evaluation of large lan- guage models for code generation. In Advances in Neural Information Processing Systems, 2023.
  13. [Miller et al., 1990] Barton P. Miller, Lars Fredriksen, and Bryan So. An empirical study of the reliability of UNIX utilities. Communications of the ACM, 33(12):32-44, 1990.
  14. [Puri et al., 2021] Ruchir Puri, David S. Kung, Geert Janssen, Wei Zhang, Giacomo Domeniconi, Vladimir Zolotov, Ju- lian Dolby, Jie Chen, Mihir R. Choudhury, Lindsey Decker, Veronika Thost, Luca Buratti, Saurabh Pujar, Shyam Ramji, Ulrich Finkler, Susan Malaika, and Frederick Reiss. Co- deNet: A large-scale AI for code dataset for learning a diversity of coding tasks. In Proceedings of the Neural Information Processing Systems Track on Datasets and Benchmarks, 2021.
  15. [Rozière et al., 2023] Baptiste Rozière, Jonas Gehring, Fabian Gloeckle, Sten Sootla, Itai Gat, Xiaoqing Ellen Tan, Yossi Adi, Jingyu Liu, Tal Remez, Jérémy Rapin, Artyom Kozhevnikov, Ivan Evtimov, Joanna Bitton, Manish Bhatt, Cristian Canton-Ferrer, Aaron Grattafiori, Wenhan Xiong, Alexandre Défossez, Jade Copet, Faisal Azhar, Hugo Tou- vron, Louis Martin, Nicolas Usunier, Thomas Scialom, and Gabriel Synnaeve. Code Llama: Open foundation models for code. CoRR, abs/2308.12950, 2023.
  16. [Srivastava and Payer, 2021] Prashast Srivastava and Mathias Payer. Gramatron: Effective grammar-aware fuzzing. In Proceedings of the 30th ACM SIGSOFT International Sym- posium on Software Testing and Analysis, pages 244-256. ACM, 2021.
  17. [Team et al., 2024] Gemma Team, Thomas Mesnard, Cassidy Hardin, Robert Dadashi, Surya Bhupatiraju, Shreya Pathak, Laurent Sifre, Morgane Rivière, Mihir Sanjay Kale, Juli- ette Love, et al. Gemma: Open models based on gemini research and technology. CoRR, abs/2403.08295, 2024.
  18. [Tian et al., 2022] Haoye Tian, Yinghua Li, Weiguo Pian, Ab- doul Kader Kaboré, Kui Liu, Andrew Habib, Jacques Klein, and Tegawendé F. Bissyandé. Predicting patch correct- ness based on the similarity of failing test cases. ACM Transactions on Software Engineering and Methodology, 31(4):77:1-77:30, 2022.
  19. [Wang et al., 2021] Yue Wang, Weishi Wang, Shafiq R. Joty, and Steven C. H. Hoi. CodeT5: Identifier-aware unified pre-trained encoder-decoder models for code understanding and generation. CoRR, abs/2109.00859, 2021.
  20. [Wang et al., 2023] Bailin Wang, Zi Wang, Xuezhi Wang, Yuan Cao, Rif A. Saurous, and Yoon Kim. Grammar prompting for domain-specific language generation with large language models. In Proceedings of the 36th An- nual Conference on Neural Information Processing Sys- tems, 2023.
  21. [Wang et al., 2024] Wenhan Wang, Chenyuan Yang, Zhijie Wang, Yuheng Huang, Zhaoyang Chu, Da Song, Lingming Zhang, An Ran Chen, and Lei Ma. TESTEVAL: bench- marking large language models for test case generation. CoRR, abs/2406.04531, 2024.
  22. [Wei et al., 2022] Jason Wei, Xuezhi Wang, Dale Schuur- mans, Maarten Bosma, Brian Ichter, Fei Xia, Ed H. Chi, Quoc V. Le, and Denny Zhou. Chain-of-Thought prompt- ing elicits reasoning in large language models. In Advances in Neural Information Processing Systems 35: Annual Con- ference on Neural Information Processing Systems, 2022.
  23. [Xia et al., 2024] Chunqiu Steven Xia, Matteo Paltenghi, Jia Le Tian, Michael Pradel, and Lingming Zhang. Fuzz4all: Universal fuzzing with large language models. In Pro- ceedings of the 46th International Conference on Software Engineering, pages 126:1-126:13. ACM, 2024.
  24. [Yang et al., 2022] Guanqun Yang, Mirazul Haque, Qiaochu Song, Wei Yang, and Xueqing Liu. TestAug: A framework for augmenting capability-based NLP tests. In Proceedings of the 29th International Conference on Computational Linguistics, pages 3480-3495. International Committee on Computational Linguistics, 2022.
  25. [Yuan et al., 2023] Zhiqiang Yuan, Yiling Lou, Mingwei Liu, Shiji Ding, Kaixin Wang, Yixuan Chen, and Xin Peng. No more manual tests? evaluating and improving ChatGPT for unit test generation. CoRR, abs/2305.04207, 2023.
  26. [Zhao et al., 2024] Yuze Zhao, Zhenya Huang, Yixiao Ma, Rui Li, Kai Zhang, Hao Jiang, Qi Liu, Linbo Zhu, and Yu Su. RePair: Automated program repair with process- based feedback. In Findings of the Association for Compu- tational Linguistics, pages 16415-16429, 2024.

References were extracted automatically from the PDF and may contain errors.

Welcome Future Conferences AI Journal Division IJCAI Proceedings About IJCAI IJCAI Awards