Contenuto principale

Test Authoring Using C/C++ xUnit API

Write tests using C or C++ macros, group tests into suites, parametrize tests

You can author tests for C/C++ code by using the Polyspace® Test™ API. The API follows the specifications of the xUnit framework for testing and supports features such as test cases and test suites with common setup and teardown functions.

The Polyspace Test xUnit API consists of function-like macros (C and C++) and test classes (C++ only) defined in files that are available with a Polyspace Test installation. To test your C/C++ code using the API:

  1. Write tests that invoke these macros or inherit from these classes.

  2. Build your tests and sources along with the Polyspace Test macro or class definition files by using your existing toolchain. Alternatively, you can add your sources and tests to a Polyspace Platform project, and build and execute them through this project.

System Commands

polyspace-test -generate(System Command) Generate test registration function from a set of Polyspace Test C/C++ test files

Topics

Getting Started

Creating Tests

Writing Assessments

Grouping Tests

Parametrizing Tests

Range Specification

Adding to Polyspace Platform Projects