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

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
40 lines
1,018 B
Text
40 lines
1,018 B
Text
# @TEST-EXEC: zeek -b %INPUT >out
|
|
# @TEST-EXEC: btest-diff out
|
|
|
|
function test_case(msg: string, expect: bool)
|
|
{
|
|
print fmt("%s (%s)", msg, expect ? "PASS" : "FAIL");
|
|
}
|
|
|
|
|
|
event zeek_init()
|
|
{
|
|
local p1: port = 1/icmp;
|
|
local p2: port = 2/udp;
|
|
local p3: port = 3/tcp;
|
|
local p4: port = 4/unknown;
|
|
local p5 = 123/tcp;
|
|
|
|
# maximum allowed values for each port type
|
|
local p6: port = 255/icmp;
|
|
local p7: port = 65535/udp;
|
|
local p8: port = 65535/tcp;
|
|
local p9: port = 255/unknown;
|
|
|
|
# Type inference test
|
|
|
|
test_case( "type inference", type_name(p5) == "port" );
|
|
|
|
# Operator tests
|
|
|
|
test_case( "protocol ordering", p1 > p2 );
|
|
test_case( "protocol ordering", p2 > p3 );
|
|
test_case( "protocol ordering", p3 > p4 );
|
|
test_case( "protocol ordering", p8 < p7 );
|
|
test_case( "protocol ordering", p9 < p6 );
|
|
test_case( "different protocol but same numeric value", p7 != p8 );
|
|
test_case( "different protocol but same numeric value", p6 != p9 );
|
|
test_case( "equality operator", 65535/tcp == p8 );
|
|
|
|
}
|
|
|