-
Notifications
You must be signed in to change notification settings - Fork 54
Expand file tree
/
Copy pathCombinationExamples.cpp
More file actions
31 lines (29 loc) · 975 Bytes
/
CombinationExamples.cpp
File metadata and controls
31 lines (29 loc) · 975 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
26
27
28
29
30
31
#include "doctest/doctest.h"
#include <vector>
#include <string>
#include "ApprovalTests/CombinationApprovals.h"
// begin-snippet: YouCanVerifyCombinationsOf2
TEST_CASE("YouCanVerifyCombinationsOf2")
{
std::vector<std::string> v{"hello", "world"};
std::vector<int> numbers{1, 2, 3};
ApprovalTests::CombinationApprovals::verifyAllCombinations(
[](std::string s, int i) {
return std::string("(") + s + ", " + std::to_string(i) + ")";
},
v,
numbers);
}
// end-snippet
// begin-snippet: CombinationsStartingPoint
TEST_CASE("CombinationsStartingPoint")
{
std::vector<std::string> inputs1{"input1.value1", "input1.value2"};
std::vector<std::string> inputs2{"input2.value1", "input2.value2", "input2.value3"};
ApprovalTests::CombinationApprovals::verifyAllCombinations(
"TITLE",
[&](auto /*input1*/, auto /*input2*/) { return "placeholder"; },
inputs1,
inputs2);
}
// end-snippet