Tom Hicks 5b9100c3a8 try 7
2025-04-09 20:39:26 -07:00
2025-04-09 20:39:26 -07:00
2025-04-09 19:33:49 -07:00
2025-04-09 19:33:49 -07:00
2023-04-26 00:07:07 -07:00
2023-04-12 15:56:24 -07:00
2025-04-09 19:33:49 -07:00
2023-04-12 15:56:24 -07:00
2023-05-10 18:34:34 -07:00
2025-04-09 19:42:37 -07:00
2025-04-09 19:42:37 -07:00
2025-04-09 19:33:49 -07:00
2025-04-09 19:33:49 -07:00
2025-04-09 20:26:37 -07:00
2025-04-09 19:33:49 -07:00
2025-04-09 19:33:49 -07:00
2025-04-09 19:33:49 -07:00
2023-05-10 01:08:14 -07:00
2025-04-09 19:33:49 -07:00
2025-04-09 19:33:49 -07:00
2023-05-10 18:34:34 -07:00

TinyTest

TinyTest is a lightweight C++ testing framework designed to simplify unit testing, with focus on ease of use and flexibility.

Key Features

  • Simple API for creating and running test suites
  • Support for test setup and teardown functions
  • Custom comparison functions for complex objects
  • Detailed test results reporting
  • Ability to skip tests conditionally
  • Integration with CMake build system

Examples

Several examples demonstrating how to use TinyTest in different environments are provided in the examples/ directory:

  1. Standalone Example: Uses CMake's FetchContent to automatically download TinyTest
  2. Preinstalled Example: Uses find_package to locate a system-installed TinyTest
  3. Sample Project: Minimal example showing basic TinyTest usage

Each example includes detailed instructions for building and running on both Windows and Linux/macOS systems.

Building with CMake

TinyTest can be built using CMake:

# Create a build directory
mkdir build && cd build

# Configure
cmake ..

# Build
cmake --build .

# Run tests
ctest

Usage Overview

Here's a simple example of how to use TinyTest:

#include <tinytest/tinytest.h>

// Function to test
int add(int a, int b) {
    return a + b;
}

int main() {
    // Create a test suite
    auto suite = TinyTest::MakeTestSuite(
        "AddFunction",
        add,
        {
            TinyTest::MakeTest("should add two positive numbers", 
                5,               // Expected result
                std::make_tuple(2, 3))  // Input parameters
        }
    );
    
    // Execute the suite and get results
    auto results = TinyTest::ExecuteSuite(suite);
    
    // Print results
    TinyTest::PrintResults(std::cout, results);
    
    return (results.Failed() > 0 || results.Errors() > 0) ? 1 : 0;
}

Integration Options

TinyTest can be integrated into your project in multiple ways:

  1. Using FetchContent - automatically downloads and builds TinyTest
  2. Using find_package - uses a pre-installed version of TinyTest
  3. Direct inclusion - directly adding TinyTest as source files

See the examples/ directory for detailed instructions on each approach.

License

TinyTest is released under the MIT License. See LICENSE file for details.

Description
A c++ testing library intended to make tests smaller using templates.
Readme 112 KiB
Languages
C++ 90.3%
Starlark 9.7%