[cpp] Add catch and qt examples
This commit is contained in:
10
cpp/catch2/include/klips.hpp
Normal file
10
cpp/catch2/include/klips.hpp
Normal file
@@ -0,0 +1,10 @@
|
||||
|
||||
#ifndef KLIPS_KLIPS_H
|
||||
#define KLIPS_KLIPS_H
|
||||
|
||||
|
||||
class klips { };
|
||||
|
||||
unsigned int factorial(unsigned int);
|
||||
|
||||
#endif // KLIPS_KLIPS_H
|
||||
29
cpp/catch2/include/type_name.hpp
Normal file
29
cpp/catch2/include/type_name.hpp
Normal 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
|
||||
Reference in New Issue
Block a user