mirror of
https://github.com/zeek/zeek.git
synced 2025-10-14 12:38:20 +00:00
Improve tests for to_port and type_name BIFs
This commit is contained in:
parent
5f16a29aea
commit
2c62b98b5b
4 changed files with 37 additions and 19 deletions
|
@ -1,6 +1,7 @@
|
|||
123/tcp
|
||||
123/udp
|
||||
123/icmp
|
||||
0/unknown
|
||||
256/tcp
|
||||
256/udp
|
||||
256/icmp
|
||||
|
|
|
@ -1,5 +1,6 @@
|
|||
string
|
||||
count
|
||||
int
|
||||
double
|
||||
bool
|
||||
time
|
||||
|
@ -18,3 +19,8 @@ set[string]
|
|||
table[count] of string
|
||||
table[string] of count
|
||||
record { c:count; s:string; }
|
||||
function(aa:int; bb:int;) : bool
|
||||
function() : any
|
||||
function() : void
|
||||
file of string
|
||||
event()
|
||||
|
|
|
@ -7,6 +7,7 @@ event bro_init()
|
|||
print to_port("123/tcp");
|
||||
print to_port("123/udp");
|
||||
print to_port("123/icmp");
|
||||
print to_port("not a port");
|
||||
|
||||
local a: transport_proto = tcp;
|
||||
local b: transport_proto = udp;
|
||||
|
|
|
@ -13,24 +13,29 @@ event bro_init()
|
|||
{
|
||||
local a = "foo";
|
||||
local b = 3;
|
||||
local c = 3.14;
|
||||
local d = T;
|
||||
local e = current_time();
|
||||
local f = 5hr;
|
||||
local g = /^foo|bar/;
|
||||
local h = Blue;
|
||||
local i = 123/tcp;
|
||||
local j = 192.168.0.2;
|
||||
local k = [fe80::1];
|
||||
local l = 192.168.0.0/16;
|
||||
local m = [fe80:1234::]/32;
|
||||
local n = vector( 1, 2, 3);
|
||||
local o = vector( "bro", "test");
|
||||
local p = set( 1, 2, 3);
|
||||
local q = set( "this", "test");
|
||||
local r: table[count] of string = { [1] = "test", [2] = "bro" };
|
||||
local s: table[string] of count = { ["a"] = 5, ["b"] = 3 };
|
||||
local t: myrecord = [ $c = 2, $s = "another test" ];
|
||||
local c = -3;
|
||||
local d = 3.14;
|
||||
local e = T;
|
||||
local f = current_time();
|
||||
local g = 5hr;
|
||||
local h = /^foo|bar/;
|
||||
local i = Blue;
|
||||
local j = 123/tcp;
|
||||
local k = 192.168.0.2;
|
||||
local l = [fe80::1];
|
||||
local m = 192.168.0.0/16;
|
||||
local n = [fe80:1234::]/32;
|
||||
local o = vector( 1, 2, 3);
|
||||
local p: vector of string = vector( "bro", "test" );
|
||||
local q = set( 1, 2, 3);
|
||||
local r = set( "this", "test");
|
||||
local s: table[count] of string = { [1] = "test", [2] = "bro" };
|
||||
local t: table[string] of count = { ["a"] = 5, ["b"] = 3 };
|
||||
local u: myrecord = [ $c = 2, $s = "another test" ];
|
||||
local v = function(aa: int, bb: int): bool { return aa < bb; };
|
||||
local w = function(): any { };
|
||||
local x = function() { };
|
||||
local y = open("deleteme");
|
||||
|
||||
print type_name(a);
|
||||
print type_name(b);
|
||||
|
@ -52,5 +57,10 @@ event bro_init()
|
|||
print type_name(r);
|
||||
print type_name(s);
|
||||
print type_name(t);
|
||||
|
||||
print type_name(u);
|
||||
print type_name(v);
|
||||
print type_name(w);
|
||||
print type_name(x);
|
||||
print type_name(y);
|
||||
print type_name(bro_init);
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue