mirror of
https://github.com/zeek/zeek.git
synced 2025-10-02 14:48:21 +00:00

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
43 lines
660 B
Text
43 lines
660 B
Text
# @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;
|