/* * Copyright (c) 2014 Eran Pe'er. * * This program is made available under the terms of the MIT License. * * Created on Mar 10, 2014 */ #pragma once #include #include #include #include "mockutils/to_string.hpp" namespace fakeit { template struct Formatter { static std::string format(const T &val) { if (std::is_const::value) return Formatter::type>::format(val); if (std::is_reference::value) return Formatter::type>::format(val); if (std::is_volatile::value) return Formatter::type>::format(val); return {"?"}; } }; template<> struct Formatter { static std::string format(const bool &val) { return val ? "true" : "false"; } }; template<> struct Formatter { static std::string format(const int &val) { return fakeit::to_string(val); } }; template<> struct Formatter { static std::string format(const unsigned int &val) { return fakeit::to_string(val); } }; template<> struct Formatter { static std::string format(const long &val) { return fakeit::to_string(val); } }; template<> struct Formatter { static std::string format(const unsigned long &val) { return fakeit::to_string(val); } }; template<> struct Formatter { static std::string format(const long long &val) { return fakeit::to_string(val); } }; template<> struct Formatter { static std::string format(const unsigned long long &val) { return fakeit::to_string(val); } }; template<> struct Formatter { static std::string format(const double &val) { return fakeit::to_string(val); } }; template<> struct Formatter { static std::string format(const long double &val) { return fakeit::to_string(val); } }; template<> struct Formatter { static std::string format(const float &val) { return fakeit::to_string(val); } }; }