-
Notifications
You must be signed in to change notification settings - Fork 9
Expand file tree
/
Copy pathTest_Correctness.cpp
More file actions
45 lines (32 loc) · 861 Bytes
/
Test_Correctness.cpp
File metadata and controls
45 lines (32 loc) · 861 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
36
37
38
39
40
41
42
43
44
45
#include "hash_trie.hpp"
#include "catch.hpp"
#include <iostream>
#include <set>
TEST_CASE( "iterate" ) {
using namespace hamt;
const int num = 1000;
std::set<int> expected;
hash_trie<int> h;
for(int i=0; i < num; ++i ) {
h.insert(i);
expected.insert( i );
}
auto it = h.begin();
auto itEnd = h.end();
std::set<int> actual;
int count = 0;
for(; it != itEnd; ++it ) {
//std::cout << *it << std::endl;
actual.insert( *it );
count++;
}
CHECK( count == num );
std::set<int> diff;
std::set_difference( expected.begin(), expected.end(), actual.begin(), actual.end(), std::inserter( diff, diff.end() ) );
if( !diff.empty() ) {
std::cout << "Missing:\n";
for (auto x : diff) {
std::cout << x << std::endl;
}
}
}