Limitations of Test Generation Using Polyspace Copilot
R2026bUsing Polyspace® Copilot, you can generate tests that validate functional requirements. However, not all functions in your code are supported for this type of test generation. This topic lists those limitations.
For more information on the steps for test generation using Polyspace Copilot, see Generate Functional Tests Using Polyspace Copilot.
Identify Why a Function Is Not Supported
If a function is not supported for test generation using Polyspace Copilot, you see an error when you right-click the function and select the option Generate Tests using Copilot. The error is followed by an explanation of why the function is not supported.
When browsing through functions on the Code pane, you can also check if a function is supported for test generation using Polyspace Copilot.
Open the Code pane. On the toolstrip, select the Code Explorer button
.Select a function on the Code pane.
On the Properties pane on the right, check the row Supported for testing with Copilot. If the value is
false, an explanation follows indicating why the function is not supported.
Unsupported Function Types
The following types of functions are not supported for test generation using Polyspace Copilot:
Functions with multiple definitions — If a function appears more than once in the codebase with the same signature, the test generator cannot determine which definition to target.
Compiler-generated functions — Functions implicitly synthesized by the compiler (for example, default constructors, destructors, or copy/move operators that are not explicitly written). Since these have no user-written body, there is no meaningful source to generate tests against.
Variadic functions — Functions that accept a variable number of arguments using
...(for example,printf-style functions). The argument types beyond the fixed parameters are unknown at compile time, making it impossible to generate typed test inputs.Deleted functions — Functions explicitly marked
= delete. These functions cannot be called, so no test can invoke them.Uninstantiated function templates — Template function definitions without concrete template arguments. Without knowing the specific types, test inputs cannot be determined. Specific instantiations of a template are supported.
mainfunctions — The program entry point is not a meaningful unit to test in isolation.Functions in anonymous namespaces — Anonymous namespaces restrict linkage to the current translation unit. The test framework cannot reference such functions from a separate test file.
Inline functions — Inline free functions and non-header methods marked
inlineare excluded. The exception is methods whose definition appears in a header file, which is the normal pattern for inline class methods.Static functions defined in a header — A
staticfunction in a header creates a separate copy per translation unit. The test generator cannot unambiguously target one copy, and such functions are unreachable by name from a test file in another translation unit.Functions whose name conflicts with a macro — If a function name is also defined as a preprocessor macro, the macro expands the function name at the call site in generated test code, producing incorrect or uncompilable tests.
Nonpublic methods —
privateorprotectedmethods cannot be called from a test file outside the class. Onlypublicmethods are supported.Methods whose owning class is inaccessible — For non-static methods, the test generator must instantiate the owning class. If the class type is inaccessible (for example, forward-declared only or defined in a private scope), no instance can be created.
Static functions at file scope — Non-method functions with internal linkage (
staticat file scope) cannot be referenced from a separate test translation unit.
Unsupported Parameter and Return Types
If a function has a return type or parameter type that meets any of the following conditions, the function is not supported for test generation using Polyspace Copilot:
Type definition not accessible — The type exists (for example, is forward-declared) but its full definition is not visible. It might be defined in a private header, an unexported scope, or not at all in the analyzed code. Without the definition, the test framework cannot allocate or initialize a value of that type.
Anonymous type — The type has no name (for example,
struct { int x; int y; } point;where the struct itself is unnamed). Anonymous types cannot be referenced by name in generated test code, so the test generator cannot declare variables of that type.