forked from ryanhaining/cppitertools
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathtestcompress.cpp
More file actions
35 lines (26 loc) · 778 Bytes
/
Copy pathtestcompress.cpp
File metadata and controls
35 lines (26 loc) · 778 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
34
35
#include <compress.hpp>
#include <vector>
#include <iostream>
using iter::compress;
template <typename DataType, typename SelectorType>
void testcase(std::vector<DataType> data_vec,
std::vector<SelectorType> sel_vec)
{
for (auto e : compress(data_vec, sel_vec)) {
std::cout << e << '\n';
}
}
int main(void)
{
std::vector<int> ivec{1, 2, 3, 4, 5, 6};
std::vector<bool> bvec{true, false, true, false, true, false};
std::cout << "Should print 1 3 5\n";
testcase(ivec, bvec);
std::vector<bool> bvec2{false, true, false, false, false, true};
std::cout << "Should print 2 6\n";
testcase(ivec, bvec2);
std::vector<bool> bvec3{false, true};
std::cout << "Should print 2\n";
testcase(ivec, bvec3);
return 0;
}