mirror of
https://github.com/zeek/zeek.git
synced 2025-10-07 17:18:20 +00:00
Use .zeek file suffix in unit tests
This commit is contained in:
parent
93d384adeb
commit
1e57e3f026
862 changed files with 533 additions and 529 deletions
|
@ -1,85 +0,0 @@
|
|||
# @TEST-DOC: Test that the ASCII writer logs values of type "double" correctly.
|
||||
#
|
||||
# @TEST-EXEC: bro -b %INPUT test-json.bro
|
||||
# @TEST-EXEC: mv test.log json.log
|
||||
# @TEST-EXEC: bro -b %INPUT
|
||||
# @TEST-EXEC: btest-diff test.log
|
||||
# @TEST-EXEC: btest-diff json.log
|
||||
#
|
||||
# Make sure we do not write out scientific notation for doubles.
|
||||
|
||||
module Test;
|
||||
|
||||
export {
|
||||
redef enum Log::ID += { LOG };
|
||||
|
||||
type Info: record {
|
||||
d: double &log;
|
||||
};
|
||||
}
|
||||
|
||||
function logwrite(val: double)
|
||||
{
|
||||
Log::write(Test::LOG, [$d=val]);
|
||||
}
|
||||
|
||||
event bro_init()
|
||||
{
|
||||
local d: double;
|
||||
local dmax: double = 1.79e308;
|
||||
local dmin: double = 2.23e-308;
|
||||
|
||||
Log::create_stream(Test::LOG, [$columns=Info]);
|
||||
|
||||
# relatively large values
|
||||
logwrite(2153226000.0);
|
||||
logwrite(2153226000.1);
|
||||
logwrite(2153226000.123456789);
|
||||
|
||||
# relatively small values
|
||||
logwrite(1.0);
|
||||
logwrite(1.1);
|
||||
logwrite(1.123456789);
|
||||
logwrite(-1.123456789);
|
||||
logwrite(1.1234);
|
||||
logwrite(.1234);
|
||||
|
||||
# scientific notation (positive exponents)
|
||||
logwrite(5e4);
|
||||
logwrite(-5e4);
|
||||
logwrite(3.14e15);
|
||||
logwrite(-3.14e15);
|
||||
logwrite(dmax);
|
||||
logwrite(-dmax);
|
||||
|
||||
# scientific notation (negative exponents)
|
||||
logwrite(1.23456789e-5);
|
||||
logwrite(dmin);
|
||||
logwrite(-dmin);
|
||||
|
||||
# inf
|
||||
d = dmax; # ok
|
||||
d = d * 2.0; # inf
|
||||
logwrite(d);
|
||||
|
||||
# -inf
|
||||
d = -dmax; # ok
|
||||
d = d * 2.0; # -inf
|
||||
logwrite(d);
|
||||
|
||||
# negative zero (compares equal to 0.0, but has different representation)
|
||||
d = -0.0;
|
||||
logwrite(d);
|
||||
|
||||
# nan
|
||||
d = dmax; # ok
|
||||
d = d * 2.0; # inf
|
||||
d = d * 0.0; # nan
|
||||
logwrite(d);
|
||||
}
|
||||
|
||||
# @TEST-START-FILE test-json.bro
|
||||
|
||||
redef LogAscii::use_json = T;
|
||||
|
||||
# @TEST-END-FILE
|
Loading…
Add table
Add a link
Reference in a new issue