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

29 lines
739 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 b1: bool = T;
local b2: bool = F;
local b3: bool = T;
local b4 = T;
local b5 = F;
test_case( "equality operator", b1 == b3 );
test_case( "inequality operator", b1 != b2 );
test_case( "logical or operator", b1 || b2 );
test_case( "logical and operator", b1 && b3 );
test_case( "negation operator", !b2 );
test_case( "absolute value", |b1| == 1 );
test_case( "absolute value", |b2| == 0 );
test_case( "type inference", type_name(b4) == "bool" );
test_case( "type inference", type_name(b5) == "bool" );
}