-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathmain.t.cpp
More file actions
39 lines (33 loc) · 740 Bytes
/
main.t.cpp
File metadata and controls
39 lines (33 loc) · 740 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
#include "hs_wrapper.h"
#include <gtest/gtest.h>
#include <hs/hs.h>
#include <functional>
using namespace ::testing;
namespace {
static bool isFound = false;
static int
eventHandler(unsigned int id,
unsigned long long from,
unsigned long long to,
unsigned int flags,
void* ctx)
{
isFound = true;
return 0;
}
}
TEST(EventBucketMain, EventBucket)
{
const char* input = "AAAA";
HyperScanDatabase hsdb(HyperScanDatabase::ScanMode::BLOCK);
hsdb.addPattern("AA", HS_FLAG_DOTALL);
isFound = false;
hsdb.scan(input, strlen(input), eventHandler);
ASSERT_TRUE(isFound);
}
int
main(int argc, char** argv)
{
::testing::InitGoogleTest(&argc, argv);
return RUN_ALL_TESTS();
}