Fix val_size BIF tests and improve docs

Improve documentation of "order" BIF, and made the "val_size" tests
more portable.
This commit is contained in:
Daniel Thayer 2012-06-08 15:25:49 -05:00
parent 83dcbd4aa7
commit 18e61fcdfc
4 changed files with 13 additions and 10 deletions

View file

@ -1494,6 +1494,8 @@ function sort%(v: any, ...%) : any
## v: The vector whose order to compute. ## v: The vector whose order to compute.
## ##
## Returns: A ``vector of count`` with the indices of the ordered elements. ## Returns: A ``vector of count`` with the indices of the ordered elements.
## For example, the elements of *v* in order are (assuming ``o``
## is the vector returned by ``order``): v[o[0]], v[o[1]], etc.
## ##
## .. bro:see:: sort ## .. bro:see:: sort
function order%(v: any, ...%) : index_vec function order%(v: any, ...%) : index_vec

View file

@ -1,2 +0,0 @@
72
72

View file

@ -22,8 +22,7 @@ function myfunc2(a: double, b: double): int
event bro_init() event bro_init()
{ {
# TODO: these results don't make sense
# Tests without supplying a comparison function # Tests without supplying a comparison function
local a1 = vector( 5, 2, 8, 3 ); local a1 = vector( 5, 2, 8, 3 );

View file

@ -1,12 +1,16 @@
# #
# @TEST-EXEC: bro %INPUT > out # @TEST-EXEC: bro %INPUT
# @TEST-EXEC: btest-diff out
event bro_init() event bro_init()
{ {
local a = 1; local a = T;
local b = T; local b = 12;
local c: table[string] of addr = { ["a"] = 192.168.0.2, ["b"] = 10.0.0.2 };
if ( val_size(a) > val_size(b) )
exit(1);
if ( val_size(b) > val_size(c) )
exit(1);
print val_size(a);
print val_size(b);
} }