blob: eb1399c5b90011a616c12dd9d652d87f4774c90a [file] [log] [blame]
Tomáš Pecka491f4f22020-11-05 15:44:00 +01001/*
2 * Copyright (C) 2016-2018 CESNET, https://photonics.cesnet.cz/
3 *
4 * Written by Jan Kundrát <jan.kundrat@cesnet.cz>
5 *
6*/
7
8#pragma once
9
10#include <doctest/doctest.h>
11#include <map>
12#include <sstream>
13#include <trompeloeil.hpp>
14
Tomáš Pecka491f4f22020-11-05 15:44:00 +010015namespace doctest {
16
17template <>
18struct StringMaker<std::map<std::string, std::string>> {
19 static String convert(const std::map<std::string, std::string>& map)
20 {
21 std::ostringstream os;
22 os << "{" << std::endl;
23 for (const auto& [key, value] : map) {
24 os << " \"" << key << "\": \"" << value << "\"," << std::endl;
25 }
26 os << "}";
27 return os.str().c_str();
28 }
29};
30
Tomáš Pecka9b1c9672020-11-11 15:24:06 +010031template <>
32struct StringMaker<std::map<std::string, int64_t>> {
33 static String convert(const std::map<std::string, int64_t>& map)
34 {
35 std::ostringstream os;
36 os << "{" << std::endl;
37 for (const auto& [key, value] : map) {
38 os << " \"" << key << "\": " << value << "," << std::endl;
39 }
40 os << "}";
41 return os.str().c_str();
42 }
43};
44
Tomáš Pecka491f4f22020-11-05 15:44:00 +010045}