Example code from the "Unit Testing in C++ Using the Catch2 Library" presentation.
More...
#include <cstdint>
#include <cmath>
#include <cstddef>
#include <string>
#include <string_view>
#include <array>
#include <stdexcept>
#include <algorithm>
#include "catch2/catch_test_macros.hpp"
#include "catch2/catch_template_test_macros.hpp"
|
std::uint32_t | factorial (std::uint32_t number) |
|
| TEST_CASE ("Factorials are computed", "[factorial]") |
|
auto | square (auto t) |
|
| TEST_CASE ("Square generic function, ints", "[square-int][square]") |
|
| TEST_CASE ("Square, double", "[square-double][square]") |
|
| TEMPLATE_TEST_CASE ("Square generic", "[square-generic][square]", int, short, float, double, long double) |
|
template<std::size_t sz> |
void | default_ctor_test () |
|
template<std::size_t sz> |
void | str_ctor_test (std::string_view s_parm) |
|
template<std::size_t sz> |
void | append_test (std::string_view s_parm, std::string_view app_parm) |
|
template<std::size_t sz> |
void | throw_test_ctr (std::string_view s_parm) |
|
template<std::size_t sz> |
void | throw_test_append (std::string_view s_parm, std::string_view app_parm) |
|
| TEST_CASE ("f_str default ctor", "[f_str]") |
|
| TEST_CASE ("f_str str ctor", "[f_str]") |
|
| TEST_CASE ("f_str append", "[f_str]") |
|
| TEST_CASE ("f_str throw", "[f_str]") |
|
Example code from the "Unit Testing in C++ Using the Catch2 Library" presentation.
This presentation gives an introduction to unit testing in C++ with the Catch2 library.
- Author
- Cliff Green
- Copyright
- (c) 2024 by Cliff Green
Distributed under the Boost Software License, Version 1.0. (See accompanying file LICENSE.txt or copy at https://www.boost.org/LICENSE_1_0.txt)