-
Notifications
You must be signed in to change notification settings - Fork 11
/
Copy pathmain.cpp
42 lines (37 loc) · 1.22 KB
/
main.cpp
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
#include <iostream>
#include "blockfilter.h"
int main()
{
srand(time(NULL));
for(int loop=0;loop<10;loop++)
{
GCSFilter::ElementSet elements2;
for (int i = 0; i < 10000; ++i)
{
GCSFilter::Element element(32);
element[0] = static_cast<unsigned char>(i);
element[1] = static_cast<unsigned char>(i >> 8);
elements2.insert(std::move(element));
}
GCSFilter filter({0, 0, 20, 1 << 20},
elements2);
GCSFilter::ElementSet elements3;
for (int j=0;j<10;j++)
{
int i=rand()%50000;
GCSFilter::Element element(32);
element[0] = static_cast<unsigned char>(i);
element[1] = static_cast<unsigned char>(i >> 8);
if(filter.Match(element))
std::cout << "Found " << i << std::endl;
else
std::cout << "Not Found " << i << std::endl;
elements3.insert(std::move(element));
}
if(filter.MatchAny(elements3))
std::cout << loop << " ***** MatchAny returned true" << std::endl;
else
std::cout << loop << " ***** MatchAny returned false" << std::endl;
}
return 0;
}