GitHub CopilotWrite better code with AI | MCP RegistryIntegrate external tools | ActionsAutomate any workflow | CodespacesInstant dev environments | IssuesPlan and track work | Code ReviewManage code changes | Code QualityEnforce quality at merge | Why GitHub | Marketplace | View all features | Enterprises | Small and medium teams | Startups | View all use cases | View all industries | View all solutions | AI | Software Development | DevOps | Security | View all topics | Customer stories | Events & webinars | Ebooks & reports | Business insights | Trust center | Partners | View all resources

Approval Tests for C++
⬇️
Download the latest version (v.10.13.0) of the single header file here.
📖
Contents
What are Approval Tests?
Also known as Golden Master Tests or Snapshot Testing, Approval Tests are an alternative to asserts. If you are unfamiliar with them, we have an
and a
.
They are great for testing objects with lots of fields, or lists of objects.
Requirements
C++11 (or above) compiler
Mac/Linux/Windows
One of:
,
,
,
,
,
Getting Started
Download
The Approval.cpp Starter Project
Read the
page
Read the
or
.
Watch the
ToString (ostream insertion)
Often, you will need to create functions to allow objects to print their state. This is commonly done with an ostream << operator. You can find examples here:
What's new?
Check out the
page or
to see what we've been working on lately, or browse the
.
Feedback
If you have any comment or suggestion on this documentation, please email Llewellyn or Clare via the details in the
.