-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathCommonTest.h
More file actions
33 lines (25 loc) · 761 Bytes
/
CommonTest.h
File metadata and controls
33 lines (25 loc) · 761 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
32
33
#pragma once
#include <vector>
#include <numeric>
#include <string>
#define TEST_NUM_COUNT10 10
#define TEST_NUM_COUNT100 100
#define TEST_NUM_COUNT1000 1000
auto IntToStringConversionTest(int count)
{
std::vector<int> inputNumbers(count);
std::vector<std::string> outNumbers;
std::iota(std::begin(inputNumbers), std::end(inputNumbers), 0);
for (auto &num : inputNumbers)
outNumbers.push_back(std::to_string(num));
return outNumbers;
}
auto DoubleToStringConversionTest(int count)
{
std::vector<double> inputNumbers(count);
std::vector<std::string> outNumbers;
std::iota(std::begin(inputNumbers), std::end(inputNumbers), 0.12345);
for (auto &num : inputNumbers)
outNumbers.push_back(std::to_string(num));
return outNumbers;
}