blob: c97cf5f26be28f5f983ed07bbc866d3546c28798 [file] [log] [blame]
Wludzik, Jozefe2362792020-10-27 17:23:55 +01001#include "utils/transform.hpp"
2
3#include <set>
4#include <vector>
5
6#include <gmock/gmock.h>
7
8using namespace testing;
9
10TEST(TestTransform, transformsVector)
11{
12 std::vector<int> input = {1, 2, 3};
13 std::vector<std::string> output =
14 utils::transform(input, [](int v) { return std::to_string(v); });
15 EXPECT_TRUE(utils::detail::has_member_reserve_v<std::vector<std::string>>);
16 ASSERT_THAT(output, ElementsAre("1", "2", "3"));
17}
18
19TEST(TestTransform, transformsSet)
20{
21 std::set<int> input = {1, 2, 3};
22 std::set<std::string> output =
23 utils::transform(input, [](int v) { return std::to_string(v); });
24 EXPECT_FALSE(utils::detail::has_member_reserve_v<std::set<std::string>>);
25 ASSERT_THAT(output, ElementsAre("1", "2", "3"));
26}