zeek/testing/btest/language/any.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

40 lines
846 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");
}
function anyarg(arg1: any, arg1type: string)
{
test_case( arg1type, type_name(arg1) == arg1type );
}
event zeek_init()
{
local any1: any = 5;
local any2: any = "bar";
local any3: any = /bar/;
# Test using variable of type "any"
anyarg( any1, "count" );
anyarg( any2, "string" );
anyarg( any3, "pattern" );
# Test of other types
anyarg( T, "bool" );
anyarg( "foo", "string" );
anyarg( 15, "count" );
anyarg( +15, "int" );
anyarg( 15.0, "double" );
anyarg( /foo/, "pattern" );
anyarg( 127.0.0.1, "addr" );
anyarg( [::1], "addr" );
anyarg( 127.0.0.1/16, "subnet" );
anyarg( [ffff::1]/64, "subnet" );
anyarg( 123/tcp, "port" );
}