Line data Source code
1 : #include "doctest/doctest.h" 2 : 3 : #include <optional> 4 : #include <vector> 5 : #include "spdlog/fmt/fmt.h" 6 : #include "spdlog/fmt/bundled/ranges.h" 7 : 8 : namespace doctest 9 : { 10 : template <typename T> 11 : struct StringMaker<std::optional<T>> { 12 0 : static String convert(std::optional<T> opt) 13 : { 14 0 : if (opt) { 15 0 : return fmt::format("{{ {} }}", *opt).c_str(); 16 : } else { 17 0 : return "{ empty }"; 18 : } 19 : } 20 : }; 21 : 22 : template <typename T> 23 : struct StringMaker<std::vector<T>> { 24 : static String convert(const std::vector<T>& value) 25 : { 26 : return fmt::format("{}", value).c_str(); 27 : } 28 : }; 29 : } // namespace doctest