zeek/testing/btest/language/set-opt-record-index.zeek
Robin Sommer 789cb376fd GH-239: Rename bro to zeek, bro-config to zeek-config, and bro-path-dev to zeek-path-dev.
This also installs symlinks from "zeek" and "bro-config" to a wrapper
script that prints a deprecation warning.

The btests pass, but this is still WIP. broctl renaming is still
missing.

#239
2019-05-01 21:43:45 +00:00

55 lines
944 B
Text

# @TEST-EXEC: zeek -b %INPUT >output 2>&1
# @TEST-EXEC: btest-diff output
# Make sure a set can be indexed with a record that has optional fields
type FOO: record {
a: count;
b: count &optional;
};
event zeek_init()
{
local set_of_foo: set[FOO] = set();
local f: FOO;
f$a = 1;
add set_of_foo[f];
add set_of_foo[[$a=3]];
local f3: FOO; # = [$a=4, $b=5];
f3$a = 4;
f3$b = 5;
add set_of_foo[f3];
add set_of_foo[[$a=4, $b=5]];
print set_of_foo;
print "";
for ( i in set_of_foo )
print i;
print "";
local f2: FOO;
f2$a = 2;
print f in set_of_foo;
print f2 in set_of_foo;
print "";
f3$a = 4;
print f3 in set_of_foo;
f3$b = 4;
print f3 in set_of_foo;
f3$b = 5;
print f3 in set_of_foo;
}