mirror of
https://github.com/zeek/zeek.git
synced 2025-10-02 06:38:20 +00:00

For backward compatibility when reading values, we first check the ZEEK-prefixed value, and if not set, then check the corresponding BRO-prefixed value.
26 lines
662 B
Text
26 lines
662 B
Text
#
|
|
# Test the quality of HLL once by checking adding a large number of IP entries.
|
|
#
|
|
# @TEST-EXEC: zeek -b %INPUT > out
|
|
# @TEST-EXEC: ZEEK_SEED_FILE="" zeek -b %INPUT > out2
|
|
# @TEST-EXEC: head -n1 out2 >> out
|
|
# @TEST-EXEC: btest-diff out
|
|
|
|
event zeek_init()
|
|
{
|
|
local cp: opaque of cardinality = hll_cardinality_init(0.1, 1.0);
|
|
local base: count = 2130706432; # 127.0.0.0
|
|
local i: count = 0;
|
|
while ( ++i < 170000 )
|
|
{
|
|
hll_cardinality_add(cp, count_to_v4_addr(base+i));
|
|
}
|
|
|
|
local res: int = double_to_count(hll_cardinality_estimate(cp));
|
|
if ( |res - 170000| > 17000 )
|
|
print "Big error";
|
|
else
|
|
print "Ok error";
|
|
|
|
print hll_cardinality_estimate(cp);
|
|
}
|