-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathtester.h
More file actions
25 lines (20 loc) · 841 Bytes
/
tester.h
File metadata and controls
25 lines (20 loc) · 841 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
#ifndef ADVENTOFCODE_TESTER_H
#define ADVENTOFCODE_TESTER_H
#include "common.h"
#include <sstream>
struct answer_to_string {
std::string operator()(std::integral auto i) { return std::to_string(i); }
std::string operator()(const std::string& s) { return s; }
std::string operator()(const std::monostate&) { return "(nil)"; }
};
struct answer_to_string2 {
std::optional<std::string> operator()(std::integral auto i) { return std::to_string(i); }
std::optional<std::string> operator()(const std::string& s) {
std::stringstream ss;
ss << std::quoted(s.c_str(), '\'');
return ss.str();
}
std::optional<std::string> operator()(const std::monostate&) { return {}; }
};
void test(int year, const yearfunctions& functions, const std::string& answer_key_path);
#endif // ADVENTOFCODE_TESTER_H