mirror of
https://github.com/zeek/zeek.git
synced 2025-10-12 11:38:20 +00:00
parent
43752b3d9f
commit
c36a449c76
6 changed files with 51 additions and 1 deletions
2
testing/btest/Baseline/bifs.to_double_from_string/error
Normal file
2
testing/btest/Baseline/bifs.to_double_from_string/error
Normal file
|
@ -0,0 +1,2 @@
|
|||
error in /da/home/robin/bro/master/testing/btest/.tmp/bifs.to_double_from_string/to_double_from_string.bro, line 7 and /da/home/robin/bro/master/testing/btest/.tmp/bifs.to_double_from_string/to_double_from_string.bro, line 15: bad conversion to count (to_double(d) and NotADouble)
|
||||
error in /da/home/robin/bro/master/testing/btest/.tmp/bifs.to_double_from_string/to_double_from_string.bro, line 7 and /da/home/robin/bro/master/testing/btest/.tmp/bifs.to_double_from_string/to_double_from_string.bro, line 16: bad conversion to count (to_double(d) and )
|
5
testing/btest/Baseline/bifs.to_double_from_string/output
Normal file
5
testing/btest/Baseline/bifs.to_double_from_string/output
Normal file
|
@ -0,0 +1,5 @@
|
|||
to_double(3.14) = 3.14 (SUCCESS)
|
||||
to_double(-3.14) = -3.14 (SUCCESS)
|
||||
to_double(0) = 0.0 (SUCCESS)
|
||||
to_double(NotADouble) = 0.0 (SUCCESS)
|
||||
to_double() = 0.0 (SUCCESS)
|
16
testing/btest/bifs/to_double_from_string.bro
Normal file
16
testing/btest/bifs/to_double_from_string.bro
Normal file
|
@ -0,0 +1,16 @@
|
|||
# @TEST-EXEC: bro -b %INPUT >output 2>error
|
||||
# @TEST-EXEC: btest-diff output
|
||||
# @TEST-EXEC: btest-diff error
|
||||
|
||||
function test_to_double(d: string, expect: double)
|
||||
{
|
||||
local result = to_double(d);
|
||||
print fmt("to_double(%s) = %s (%s)", d, result,
|
||||
result == expect ? "SUCCESS" : "FAILURE");
|
||||
}
|
||||
|
||||
test_to_double("3.14", 3.14);
|
||||
test_to_double("-3.14", -3.14);
|
||||
test_to_double("0", 0);
|
||||
test_to_double("NotADouble", 0);
|
||||
test_to_double("", 0);
|
Loading…
Add table
Add a link
Reference in a new issue