mirror of https://github.com/catchorg/Catch2.git
Split out ratio_string::symbol bodies
This commit is contained in:
parent
b083b04126
commit
baf3d2f360
|
@ -30,6 +30,7 @@
|
||||||
# if defined(CATCH_CONFIG_DISABLE_MATCHERS)
|
# if defined(CATCH_CONFIG_DISABLE_MATCHERS)
|
||||||
# undef CATCH_CONFIG_DISABLE_MATCHERS
|
# undef CATCH_CONFIG_DISABLE_MATCHERS
|
||||||
# endif
|
# endif
|
||||||
|
# define CATCH_CONFIG_ENABLE_CHRONO_STRINGMAKER
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#if !defined(CATCH_CONFIG_IMPL_ONLY)
|
#if !defined(CATCH_CONFIG_IMPL_ONLY)
|
||||||
|
|
|
@ -12,6 +12,10 @@
|
||||||
# pragma clang diagnostic ignored "-Wglobal-constructors"
|
# pragma clang diagnostic ignored "-Wglobal-constructors"
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
// Enable specific decls locally
|
||||||
|
#if !defined(CATCH_CONFIG_ENABLE_CHRONO_STRINGMAKER)
|
||||||
|
#define CATCH_CONFIG_ENABLE_CHRONO_STRINGMAKER
|
||||||
|
#endif
|
||||||
|
|
||||||
#include "catch_tostring.h"
|
#include "catch_tostring.h"
|
||||||
#include "catch_interfaces_config.h"
|
#include "catch_interfaces_config.h"
|
||||||
|
@ -221,6 +225,13 @@ std::string StringMaker<double>::convert(double value) {
|
||||||
return fpToString(value, 10);
|
return fpToString(value, 10);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
std::string ratio_string<std::atto>::symbol() { return "a"; }
|
||||||
|
std::string ratio_string<std::femto>::symbol() { return "f"; }
|
||||||
|
std::string ratio_string<std::pico>::symbol() { return "p"; }
|
||||||
|
std::string ratio_string<std::nano>::symbol() { return "n"; }
|
||||||
|
std::string ratio_string<std::micro>::symbol() { return "u"; }
|
||||||
|
std::string ratio_string<std::milli>::symbol() { return "m"; }
|
||||||
|
|
||||||
|
|
||||||
} // end namespace Catch
|
} // end namespace Catch
|
||||||
|
|
||||||
|
|
|
@ -351,6 +351,9 @@ namespace Catch {
|
||||||
#include <ratio>
|
#include <ratio>
|
||||||
#include <chrono>
|
#include <chrono>
|
||||||
|
|
||||||
|
|
||||||
|
namespace Catch {
|
||||||
|
|
||||||
template <class Ratio>
|
template <class Ratio>
|
||||||
struct ratio_string {
|
struct ratio_string {
|
||||||
static std::string symbol();
|
static std::string symbol();
|
||||||
|
@ -365,30 +368,29 @@ std::string ratio_string<Ratio>::symbol() {
|
||||||
}
|
}
|
||||||
template <>
|
template <>
|
||||||
struct ratio_string<std::atto> {
|
struct ratio_string<std::atto> {
|
||||||
static std::string symbol() { return "a"; }
|
static std::string symbol();
|
||||||
};
|
};
|
||||||
template <>
|
template <>
|
||||||
struct ratio_string<std::femto> {
|
struct ratio_string<std::femto> {
|
||||||
static std::string symbol() { return "f"; }
|
static std::string symbol();
|
||||||
};
|
};
|
||||||
template <>
|
template <>
|
||||||
struct ratio_string<std::pico> {
|
struct ratio_string<std::pico> {
|
||||||
static std::string symbol() { return "p"; }
|
static std::string symbol();
|
||||||
};
|
};
|
||||||
template <>
|
template <>
|
||||||
struct ratio_string<std::nano> {
|
struct ratio_string<std::nano> {
|
||||||
static std::string symbol() { return "n"; }
|
static std::string symbol();
|
||||||
};
|
};
|
||||||
template <>
|
template <>
|
||||||
struct ratio_string<std::micro> {
|
struct ratio_string<std::micro> {
|
||||||
static std::string symbol() { return "u"; }
|
static std::string symbol();
|
||||||
};
|
};
|
||||||
template <>
|
template <>
|
||||||
struct ratio_string<std::milli> {
|
struct ratio_string<std::milli> {
|
||||||
static std::string symbol() { return "m"; }
|
static std::string symbol();
|
||||||
};
|
};
|
||||||
|
|
||||||
namespace Catch {
|
|
||||||
////////////
|
////////////
|
||||||
// std::chrono::duration specializations
|
// std::chrono::duration specializations
|
||||||
template<typename Value, typename Ratio>
|
template<typename Value, typename Ratio>
|
||||||
|
|
Loading…
Reference in New Issue