Handy C++ test framework

Related tags

Testing voyager
Overview

C++ Voyager Test Framework

Voyager is a simple and handy C++ Unit Test framework. It is designed to be beautiful and expressive both. Try it to feel it!

Installation

To add Voyger to your new or existing project, add it to a subfolder as a submodule using following git command:

git submodule add https://github.com/anafro/voyager Path/To/Voyager/Folder

Then just update your CMakeLists.txt with following code:

# --- Voyager Test ---
add_subdirectory(Path/To/Voyager/Folder)
target_link_libraries(YourProjectName VoyagerLibrary)

And that's it! Easy, isn't it? :)

Requirements

Voyager can be used only from C++11 and higher.

Adding tests

To add a new test, write:

Voyager::test("Test Name", [](auto& shouldBe) {
    // Your test case will be here
});

Test name should be in this form: all of the words are separated with a space and capitalized. If you don't follow this form, it won't cause an error, but we are highly recommend to follow it.

Writing tests

Write your code as usual - there are no restrictions. There are some functions that will help you to test:

Important: if some of the test functions fails, test won't be stopped! To stop test execution, just return from it.

equalTrue

shouldBe.equalTrue(bool expression, std::string messageIfFailed);

If expression is not true, test will fail.

equalFalse

shouldBe.equalFalse(bool expression, std::string messageIfFailed);

If expression is not false, test will fail.

failed

shouldBe.failed(std::string message);

Fails the test unconditionally. It will be helpful, if, for example, your code should not throw any exception, but when it does, you'll write failed(...)

Running tests

To run all the tests, use Voyager::run();

Example test

Voyager::test("Water Boiling", [](auto& shouldBe) {
  Water water;
  water.boil();
  shouldBe.equalTrue(water.getTemperature() == 100);
});

Voyager::test("Water Freezing", [](auto& shouldBe) {
  Water water;
  water.freeze();
  shouldBe.equalTrue(water.getTemperature() == 0);
  shouldBe.equalTrue(water.getState() == SOLID);
});

Voyager::run();

Issues

If you discover any issues or problems in Voyager, please, send an email to Anafro via [email protected]

License

The Voyager Test framework is open-sourced software licensed under the GNU General Public License v3.

Owner
Anatoly Frolov
Hi! I am Anatoly Frolov. I am a junior programming engineer. I hope that code will save the world!
Anatoly Frolov
A modern, C++-native, header-only, test framework for unit-tests, TDD and BDD - using C++11, C++14, C++17 and later (or C++03 on the Catch1.x branch)

Catch2 v3 is being developed! You are on the devel branch, where the next major version, v3, of Catch2 is being developed. As it is a significant rewo

Catch Org 14.3k Dec 6, 2021
End to end test framework designed for Juce applications

JUCE End to End test framework What is it? This package provides a mechanism to end-to-end test a JUCE application Prerequisites CMake. Must be 3.18 o

Focusrite Audio Engineering Ltd. 21 Dec 7, 2021
Various Framework to do Unit Test in C++

Unit Test in C++ There are many frameworks to performs unit test in C++, we will present the most popular ones and show how to use them. The testing f

Yassine 2 Nov 18, 2021
A dynamic mock tool for C/C++ unit test on Linux&MacOS X86_64

lmock 接口 替换一个函数,修改机器指令,用新函数替换旧函数,支持全局函数(包括第三方和系统函数)、成员函数(包括静态和虚函数)

null 34 Nov 26, 2021
PlatformIO + BL602 Bouffalo Arduino Core Test

PlatformIO + BL602 Bouffalo Arduino Core Test Description Uses A custom extension of the PlatformIO SiFive Platform (https://github.com/maxgerhardt/pl

Maximilian Gerhardt 2 Sep 29, 2021
A test showing a flipped bit in a file encrypted on two different machines

ChaCha ASM Test I have observed that the ChaCha cipher may have very rarely divergent code paths for AVX vs. SSE. I have seen this in earlier CryptoPP

Austin Clifton 2 Nov 20, 2021
A tool to test if a shared library is dlopen'ble

A tool to test if a shared library is dlopen'ble

Mahin Ahmed 1 Oct 17, 2021
An area to test reading in ATLAS xAOD format and writing out to Parquet

xaod_to_parquet An area to test reading in ATLAS xAOD format and writing out to Parquet Getting the Code Clone the repository with the --recursive fla

Daniel Antrim 2 Nov 19, 2021
The fastest feature-rich C++11/14/17/20 single-header testing framework

master branch Windows All dev branch Windows All doctest is a new C++ testing framework but is by far the fastest both in compile times (by orders of

Viktor Kirilov 3.6k Dec 7, 2021
Googletest - Google Testing and Mocking Framework

GoogleTest OSS Builds Status Announcements Release 1.10.x Release 1.10.x is now available. Coming Soon Post 1.10.x googletest will follow Abseil Live

Google 24.4k Dec 6, 2021
C++ xUnit-like testing framework without macros

tst C++ testing framework. Installation, documentation, tutorials See WiKi. Features xUnit-like concepts minimal use of preprocessor macros declarativ

cppfw 7 Nov 8, 2021
c++ testing framework

iutest iutest - iris unit test framework Welcome to the iutest iutest is framework for writing C++ tests. Features An XUnit test framework. Header onl

srz_zumix 55 Nov 20, 2021
A modern, C++11-native, single-file header-only, tiny framework for unit-tests, TDD and BDD (includes C++98 variant)

lest – lest errors escape testing This tiny C++11 test framework is based on ideas and examples by Kevlin Henney [1,2] and on ideas found in the CATCH

Martin Moene 331 Dec 1, 2021
UT: C++20 μ(micro)/Unit Testing Framework

"If you liked it then you "should have put a"_test on it", Beyonce rule UT / μt | Motivation | Quick Start | Overview | Tutorial | Examples | User Gui

boost::ext 706 Dec 2, 2021
Header only C++14 mocking framework

Trompeloeil Get: trompe l'oeil noun (Concise Encyclopedia) Style of representation in which a painted object is intended to deceive the viewer into be

Björn Fahller 588 Nov 27, 2021
C++ Unit Testing Easier: A Header-only C++ unit testing framework

CUTE C++ Unit Testing Easier: A Header-only C++ unit testing framework usually available as part of the Cevelop C++ IDE (http://cevelop.com) Dependenc

Peter Sommerlad 32 Nov 9, 2021
A complete unit testing framework in a header

liblittletest A complete unit testing framework in a header liblittletest is an easy to use all-in-an-header testing framework; all you have to do in

Sebastiano Merlino 13 Nov 11, 2021
Modern c++17 unit testing framework on Microsoft Windows, Apple macOS, Linux, iOS and android.

tunit Modern c++17 unit testing framework on Windows, macOS, Linux, iOS and android. Continuous Integration build status Operating system Status Windo

Gammasoft 6 Oct 1, 2021
Simple C testing framework

MrTest Simple C testing framework Usage Copy the mrtest.c and mrtest.h file into your project. In order to use the mrtest main: create a .c file that

Maarten Raasveldt 3 Nov 14, 2021