dot-xx
A personal collection of small C++ modules
Loading...
Searching...
No Matches
name_deduce.xx File Reference

Unit test name deduction from callable type name. More...

import std;
import dxx.cstd.fixed;

Namespaces

namespace  dxx::selftest
 Main namespace of dxx::selftest module.

Concepts

concept  dxx::selftest::named_test_body

Functions

template<typename T>
consteval std::string_view dxx::selftest::function_name ()
 Forwards its own std::source_location::function_name()
template<typename T>
consteval auto dxx::selftest::function_name_sanitize ()
 Removes anonymous namespace mentions from the function name.
template<typename T>
consteval std::tuple< std::optional< std::string_view >, uz > dxx::selftest::get_test_name_cpp ()
 Gets the C++ name of the type's scope (if it starts with test::) and gets rid of the test:: part, e.g. for test::a::b::c it will return a::b::c
template<typename T>
consteval auto dxx::selftest::get_test_name_data ()
 Convertes get_test_name_cpp return value into a fixed length character array (or an empty optional)
template<typename T>
consteval std::optional< std::string_view > dxx::selftest::get_test_name ()
 Get an optional string_view with the test name, or nullopt if not a test for some reason.

Variables

constexpr auto dxx::selftest::test_prefix = "T = test::"sv
constexpr std::array dxx::selftest::anonymous_indicators
template<typename T>
constexpr auto dxx::selftest::test_name = get_test_name_data<T>()
 A constexpr string_view returned by get_test_name should point to somewhere in the program memmory. This is that somewhere.
auto some::ns::l = [] {}

Detailed Description

Unit test name deduction from callable type name.