mirror of
https://github.com/zeek/zeek.git
synced 2025-10-10 18:48:20 +00:00
Merge remote-tracking branch 'origin/topic/dev/patterns-in-sets'
Fixes in merge: - Memory leak in HashKey ctor - Minor whitespace/style changes * origin/topic/dev/patterns-in-sets: Enable Patterns as Table index in non singleton cases Added support to create a Hashkey for PatternVals using their Pattern Texts
This commit is contained in:
commit
d581aa76aa
8 changed files with 140 additions and 4 deletions
19
testing/btest/Baseline/language.table-pattern-index/out
Normal file
19
testing/btest/Baseline/language.table-pattern-index/out
Normal file
|
@ -0,0 +1,19 @@
|
|||
/^?(one|foo|bar)$?/
|
||||
/^?(two|oob)$?/
|
||||
/^?(three|oob)$?/
|
||||
/^?(four)$?/
|
||||
-----------------
|
||||
/^?(two|oob)$?/
|
||||
/^?(four)$?/
|
||||
/^?(one|foo|bar)$?/
|
||||
/^?(three|oob)$?/
|
||||
-----------------
|
||||
/^?(two|oob)$?/, 1
|
||||
/^?(four)$?/, 3
|
||||
/^?(one|foo|bar)$?/, 0
|
||||
/^?(three|oob)$?/, 2
|
||||
-----------------
|
||||
/^?(two|oob)$?/, 3, 2
|
||||
/^?(one|foo|bar)$?/, 2, 0
|
||||
/^?(four)$?/, 5, 6
|
||||
/^?(three|oob)$?/, 4, 4
|
43
testing/btest/language/table-pattern-index.zeek
Normal file
43
testing/btest/language/table-pattern-index.zeek
Normal file
|
@ -0,0 +1,43 @@
|
|||
# @TEST-EXEC: zeek -b %INPUT >out
|
||||
# @TEST-EXEC: btest-diff out
|
||||
|
||||
local p1: pattern = /one|foo|bar/;
|
||||
local p2: pattern = /two|oob/;
|
||||
local p3: pattern = /three|oob/;
|
||||
local p4 = /four/;
|
||||
|
||||
local p: set[pattern] = {p1, p2, p3, p4};
|
||||
|
||||
local t: table[pattern] of count = {
|
||||
[p1] = 0,
|
||||
[p2] = 1,
|
||||
[p3] = 2,
|
||||
[p4] = 3
|
||||
};
|
||||
|
||||
local t2: table[pattern, count] of count = {
|
||||
[p1,2] = 0,
|
||||
[p2,3] = 2,
|
||||
[p3,4] = 4,
|
||||
[p4,5] = 6
|
||||
};
|
||||
|
||||
print p1;
|
||||
print p2;
|
||||
print p3;
|
||||
print p4;
|
||||
|
||||
print "-----------------";
|
||||
|
||||
for ( key in p )
|
||||
print key;
|
||||
|
||||
print "-----------------";
|
||||
|
||||
for ( key, value in t )
|
||||
print key, value;
|
||||
|
||||
print "-----------------";
|
||||
|
||||
for ( [c1, c2], value in t2)
|
||||
print c1, c2, value;
|
2
testing/external/commit-hash.zeek-testing
vendored
2
testing/external/commit-hash.zeek-testing
vendored
|
@ -1 +1 @@
|
|||
8be265e13e9ddb2dda704bf1574b1307fc17eea9
|
||||
da47ae786562da18910d994b7868530929db6271
|
||||
|
|
|
@ -1 +1 @@
|
|||
2f6f3b9211f5f5b04a2ede17835d0a4a523888f1
|
||||
931f49917a86a260c69e091c2f66b693e74b33bf
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue