Unit Test Benchmark Dataset for Complex C++ Code Generation

Resolve Bottlenecks,
Find Innovative Solutions
Generate Solutions

Solution Overview

Problem

Existing unit test generation systems are ineffective for C and C++ code due to high Kolmogorov and cyclomatic complexity, and there is a lack of comprehensive unit test coverage and documentation in source code repositories, making it difficult to generate effective unit tests manually or using conventional tools.

Innovation Solution

An automated process generates a unit test benchmarking dataset from a codebase, extracting method and unit test signatures to train a Large Language Model (LLM) for generating unit tests, reducing manual effort and improving efficiency.

Engineering Contradictions & Design Principles

VSEngineering Contradiction Analysis

1Reliability

If existing unit test generation systems are used for C and C++ code, then the systems can process code, but they fail to generate effective unit tests due to high Kolmogorov and cyclomatic complexity

Engineering Contradiction:
Improveunit test generation effectivenessVSAvoidcode complexity
Core Design Contradiction:
ReliabilityVSDevice complexity

Solution Approach 1:

The patent segments the codebase into modules and identifies unit testable components by extracting method signatures and relationships. This segmentation allows the LLM to process complex C++ code in manageable units, focusing on individual methods and their testable behaviors rather than the entire codebase at once.

Inventive Principle:
Principle #1Segmentation

Solution Approach 2:

The patent introduces an intermediary representation layer using method signatures and relationship graphs that bridge the complex C++ code and the LLM. This intermediary format simplifies the code structure while preserving essential semantic information, making it suitable for LLM processing and unit test generation.

Inventive Principle:
Principle #24Intermediary (Mediator)

2Reliability

If manual unit test development is used, then developers can create comprehensive tests, but it requires significant time and manual effort

Engineering Contradiction:
Improveunit test coverageVSAvoidtest development time
Core Design Contradiction:
ReliabilityVSLoss of time

Solution Approach 1:

The system performs self-service by automatically extracting method signatures, identifying testable components, and generating unit tests without requiring developer intervention. The LLM autonomously processes the codebase, identifies testing requirements, and produces test cases that cover corner and edge cases.

Inventive Principle:
Principle #25Self-service

Solution Approach 2:

The patent performs preliminary actions by pre-processing the codebase to extract method signatures, build relationship graphs, and identify testable components before actual test generation. This preparation step organizes the complex code information into a structured format that facilitates efficient automated test generation.

Inventive Principle:
Principle #10Preliminary action

3Quantity of substance

If source code repositories are used for unit test examples, then code examples are available, but they lack comprehensive coverage and proper documentation of function-test relationships

Engineering Contradiction:
Improveunit test examplesVSAvoidfunction-test relationship documentation
Core Design Contradiction:
Quantity of substanceVSLoss of information

Solution Approach 1:

The patent extracts essential information from the codebase including method signatures, parameter types, return values, and relationships between methods. This extraction creates a simplified representation that captures the critical semantic information needed for unit test generation, filtering out unnecessary code details.

Inventive Principle:
Principle #2Taking out (Extraction)

Solution Approach 2:

The patent creates a universal representation format using method signatures and relationship graphs that can be applied across different C++ codebases. This universal format enables the system to handle various programming patterns, frameworks, and code styles consistently, making the approach broadly applicable.

Inventive Principle:
Principle #6Universality (Multi-functionality)

4Ease of operation

If automated unit test generation is implemented, then manual effort is reduced, but the generated tests may lack efficacy without manual oversight

Engineering Contradiction:
Improvemanual effortVSAvoidtest efficacy
Core Design Contradiction:
Ease of operationVSReliability

Solution Approach 1:

The system incorporates feedback mechanisms where the LLM iteratively refines generated unit tests based on the extracted code information and relationship graphs. The feedback loop ensures that generated tests accurately reflect the source code's intended behavior, handling corner and edge cases appropriately.

Inventive Principle:
Principle #23Feedback

Data Source

PatentUS20260072810A1Unit test benchmarking dataset generation and use
Publication Date: 2026.03.12 NUTANIX INC
  • US20260072810A1 patent drawing
  • US20260072810A1 patent drawing
  • US20260072810A1 patent drawing

AI summary

Techniques for unit test benchmarking dataset generation and use include performing steps comprising retrieving source code and test code from a codebase; extracting, using a large language model, a plurality of methods from the source code; extracting, using a large language model, a plurality of unit test functions from the test code; generating a test entry that relates a respective method signature of a plurality of method signatures to one or more unit test signatures of a plurality of unit test signatures; and storing the test entry in a unit test benchmark dataset, the test entry comprising a method of the plurality of methods and one or more unit test functions of the plurality of unit test functions, wherein the method corresponds to the respective method signature and the one or more unit test functions correspond to the one or more unit test signatures.