Rapidcheck

screenshot of Rapidcheck

QuickCheck clone for C++ with the goal of being simple to use with as little boilerplate as possible.

Overview

RapidCheck is a C++ framework for property-based testing, inspired by QuickCheck and similar frameworks. It allows you to state facts about your code that should always be true given certain preconditions. RapidCheck generates random test data to try and find cases where the properties don't hold, and it also attempts to find the smallest case where the property is false and displays it as a counterexample. RapidCheck is designed to be easy to use with C++, provides support for STL types, and offers advanced features such as test case shrinking and integration with popular testing frameworks.

Features

  • Imperative Property Writing: RapidCheck allows you to write properties in an imperative way that is suitable for C++.
  • Test Case Shrinking: RapidCheck includes test case shrinking, where it tries to find the smallest case that causes a property to fail.
  • STL Support: RapidCheck has great support for STL types, including maps and sets.
  • Advanced Combinators: RapidCheck offers advanced combinators that allow you to create your own generators.
  • Stateful Testing: RapidCheck supports stateful testing based on commands, similar to Erlang QuickCheck.
  • Integration with Testing Frameworks: RapidCheck integrates with popular testing frameworks such as Boost Test, Google Test, and Google Mock.

Summary

RapidCheck is a C++ framework for property-based testing that aims to provide a user-friendly and feature-rich experience. It allows you to write properties in an imperative way, supports test case shrinking, offers extensive STL support, includes advanced combinators for custom generators, and enables stateful testing based on commands. RapidCheck integrates with popular testing frameworks and requires a C++11 compliant compiler for installation. Overall, RapidCheck is a powerful tool for ensuring the correctness of your C++ code through property-based testing.