Line |
Branch |
Exec |
Source |
1 |
|
|
#include <iostream> |
2 |
|
|
#include <vector> |
3 |
|
|
#include <functional> |
4 |
|
|
#include <string> |
5 |
|
|
#include <optional> |
6 |
|
|
#include <set> |
7 |
|
|
#include <map> |
8 |
|
|
#include <list> |
9 |
|
|
#include <deque> |
10 |
|
|
#include <unordered_set> |
11 |
|
|
#include <unordered_map> |
12 |
|
|
|
13 |
|
|
#include "TestCommon.h" |
14 |
|
|
|
15 |
|
|
// ################################################################################################ |
16 |
|
|
// CONSTEXPR |
17 |
|
|
// ################################################################################################ |
18 |
|
8 |
TEST(CXXIter, constexprCorrectness) { |
19 |
|
|
{ |
20 |
|
2 |
constexpr size_t output = CXXIter::range(0, 5).size(); |
21 |
|
|
static_assert(output == 6); |
22 |
|
|
} |
23 |
|
|
{ |
24 |
|
2 |
constexpr size_t output = CXXIter::range(0, 5).sum(); |
25 |
|
|
static_assert(output == 15); |
26 |
|
|
} |
27 |
|
|
{ |
28 |
|
2 |
constexpr std::array<size_t, 4> input = {42, 69, 77, 1337}; |
29 |
|
2 |
constexpr size_t output = CXXIter::from(input).mean().value(); |
30 |
|
|
static_assert(output == 381); |
31 |
|
|
} |
32 |
|
2 |
} |
33 |
|
|
|