zeek/testing/btest/language/at-load.bro
Jon Siwek 95ffb1cf27 Quick pass over unit tests, adding -b flag to bro so they run faster.
Doing this made bifs/ ~3x faster and language/ ~2x faster.
2012-11-30 17:44:36 -06:00

43 lines
922 B
Text

# @TEST-EXEC: bro -b %INPUT >out
# @TEST-EXEC: btest-diff out
# In this script, we try to access each object defined in a "@load"ed script
@load secondtestfile
event bro_init()
{
test_case( "function", T );
test_case( "global variable", num == 123 );
test_case( "const", daysperyear == 365 );
event testevent( "foo" );
}
# @TEST-START-FILE secondtestfile
# In this script, we define some objects to be used in another script
# Note: this script is not listed on the bro command-line (instead, it
# is "@load"ed from the other script)
global test_case: function(msg: string, expect: bool);
global testevent: event(msg: string);
global num: count = 123;
const daysperyear: count = 365;
function test_case(msg: string, expect: bool)
{
print fmt("%s (%s)", msg, expect ? "PASS" : "FAIL");
}
event testevent(msg: string)
{
test_case( "event", T );
}
# @TEST-END-FILE