mirror of
https://github.com/zeek/zeek.git
synced 2025-10-02 06:38:20 +00:00
test suite updates for expanded sort() BiF semantics (bools, doubles)
This commit is contained in:
parent
ab0b773522
commit
98ada4e419
2 changed files with 23 additions and 5 deletions
|
@ -3,12 +3,14 @@
|
|||
[2, 3, 5, 8]
|
||||
[-7.0 mins, 1.0 sec, 5.0 hrs, 2.0 days]
|
||||
[-7.0 mins, 1.0 sec, 5.0 hrs, 2.0 days]
|
||||
[T, F, F, T]
|
||||
[T, F, F, T]
|
||||
[F, F, T, T]
|
||||
[F, F, T, T]
|
||||
[57/tcp, 123/tcp, 7/udp, 500/udp, 12/icmp]
|
||||
[57/tcp, 123/tcp, 7/udp, 500/udp, 12/icmp]
|
||||
[3.03, 3.01, 3.02, 3.015]
|
||||
[3.03, 3.01, 3.02, 3.015]
|
||||
[12/icmp, 123/tcp, 500/udp, 7/udp, 57/tcp]
|
||||
[12/icmp, 123/tcp, 500/udp, 7/udp, 57/tcp]
|
||||
[3.01, 3.015, 3.02, 3.03]
|
||||
[3.01, 3.015, 3.02, 3.03]
|
||||
[192.168.123.200, 10.0.0.157, 192.168.0.3]
|
||||
[192.168.123.200, 10.0.0.157, 192.168.0.3]
|
||||
[10.0.0.157, 192.168.0.3, 192.168.123.200]
|
||||
|
|
|
@ -20,6 +20,16 @@ function myfunc2(a: double, b: double): int
|
|||
return 1;
|
||||
}
|
||||
|
||||
function myfunc3(a: bool, b: bool): int
|
||||
{
|
||||
if (a == b)
|
||||
return 0;
|
||||
else if (a)
|
||||
return 1;
|
||||
else
|
||||
return -1;
|
||||
}
|
||||
|
||||
event zeek_init()
|
||||
{
|
||||
# Tests without supplying a comparison function
|
||||
|
@ -34,17 +44,23 @@ event zeek_init()
|
|||
print a2;
|
||||
print b2;
|
||||
|
||||
# this one is expected to fail (i.e., "sort" doesn't sort the vector)
|
||||
local a3: vector of bool = vector( T, F, F, T );
|
||||
local b3 = sort(a3);
|
||||
print a3;
|
||||
print b3;
|
||||
|
||||
local a3x: vector of bool = vector( T, F, F, T );
|
||||
local b3x = sort(a3x, myfunc3);
|
||||
print a3x;
|
||||
print b3x;
|
||||
|
||||
# this one is expected to fail (i.e., "sort" doesn't sort the vector)
|
||||
local a4: vector of port = vector( 12/icmp, 123/tcp, 500/udp, 7/udp, 57/tcp );
|
||||
local b4 = sort(a4);
|
||||
print a4;
|
||||
print b4;
|
||||
|
||||
# this one is expected to fail (i.e., "sort" doesn't sort the vector)
|
||||
local a5: vector of double = vector( 3.03, 3.01, 3.02, 3.015 );
|
||||
local b5 = sort(a5);
|
||||
print a5;
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue