[cpp] Add catch and qt examples

This commit is contained in:
2022-12-18 08:52:03 -05:00
parent d1fb33c58e
commit de652bad32
33 changed files with 19042 additions and 1 deletions

View File

@@ -0,0 +1,10 @@
#ifndef KLIPS_KLIPS_H
#define KLIPS_KLIPS_H
class klips { };
unsigned int factorial(unsigned int);
#endif // KLIPS_KLIPS_H

View File

@@ -0,0 +1,29 @@
// Authored by 康桓瑋 on SO: https://stackoverflow.com/a/56766138
#ifndef CATCH2_TYPE_NAME_HPP
#include <string_view>
template <typename T>
constexpr auto type_name() {
std::string_view name, prefix, suffix;
#ifdef __clang__
name = __PRETTY_FUNCTION__;
prefix = "auto type_name() [T = ";
suffix = "]";
#elif defined(__GNUC__)
name = __PRETTY_FUNCTION__;
prefix = "constexpr auto type_name() [with T = ";
suffix = "]";
#elif defined(_MSC_VER)
name = __FUNCSIG__;
prefix = "auto __cdecl type_name<";
suffix = ">(void)";
#endif
name.remove_prefix(prefix.size());
name.remove_suffix(suffix.size());
return name;
}
#define CATCH2_TYPE_NAME_HPP
#endif // CATCH2_TYPE_NAME_HPP