cpp-testing

Run C++ unit and integration tests with GoogleTest and CMake/CTest.

15|1|Updated Feb 12, 2026
One-click install
npx skills add https://github.com/AeonDave/malskill --skill cpp-testing-aeondave
Or copy as Structured Prompt for Agent
Please help me install this Agent Skill.
Skill: cpp-testing
Source: https://github.com/AeonDave/malskill/tree/main/programming/cpp-testing
Command: npx skills add https://github.com/AeonDave/malskill --skill cpp-testing-aeondave

SYSTEM DOCUMENTATION & REQUIREMENTS

💡 This Skill includes references (resource) components.

What problem does it solve?

This Skill streamlines the process of writing, debugging, and maintaining reliable unit and integration tests for C++ projects, ensuring code correctness and stability.

Core Features & Use Cases

  • Test Framework Integration: Seamlessly integrate GoogleTest and GoogleMock with CMake and CTest build systems.
  • Debugging & Diagnostics: Efficiently diagnose and fix flaky tests, memory errors, undefined behavior, and race conditions using sanitizers and debugging tools.
  • Coverage Analysis: Generate code coverage reports to identify untested code paths.
  • Use Case: When a C++ application fails its test suite due to a suspected memory leak, this Skill can be activated to run tests with AddressSanitizer enabled and guide the debugging process using GDB.

Quick Start

Activate this skill to help write a new unit test for the calculate_sum function in math_utils.cpp using GoogleTest and CMake.

Frequently Asked Questions about cpp-testing

High-intent search queries and answers about installing and using this skill.

FAQPage Schema
How do I integrate GoogleTest with CMake and CTest for C++ testing?

Integrate GoogleTest with CMake by configuring test build targets and registering them via CTest. This workflow streamlines running unit and integration tests directly within your build system.

What is the best way to diagnose flaky tests and memory leaks in C++?

Diagnose flaky C++ tests and memory leaks by running sanitizers like AddressSanitizer. This detects memory errors and undefined behavior, guiding your debugging process with tools like GDB.

Do I need C++20 and CMake 3.20 to use sanitizers for debugging?

Yes, a C++20 baseline and CMake 3.20 or higher are required to properly configure and run sanitizers. Optionally, you need coverage tools and GoogleTest installed for full testing workflows.

How do I generate code coverage reports for untested C++ code paths?

Generate C++ code coverage reports by integrating coverage tools into your CMake build. This analysis identifies untested code paths and provides a correctness signal for your test suite.

Why does my C++ test suite fail with undefined behavior or race conditions?

C++ test suites fail with undefined behavior or race conditions due to memory mishandling or threading issues. Run UBSan and TSan sanitizers to accurately diagnose these specific runtime failures.