Add baseline for find_first test, update comments, and reorder function imports

This commit is contained in:
yexiaochuan 2025-05-02 11:51:26 +08:00
parent 6c240dc0bb
commit fd7045e274
3 changed files with 9 additions and 5 deletions

View file

@ -263,9 +263,9 @@ static std::unordered_map<std::string, unsigned int> func_attrs = {
{"find_all", ATTR_FOLDABLE},
{"find_all_ordered", ATTR_FOLDABLE},
{"find_entropy", ATTR_FOLDABLE},
{"find_first", ATTR_FOLDABLE},
{"find_in_zeekpath", ATTR_IDEMPOTENT}, // can error
{"find_last", ATTR_FOLDABLE},
{"find_first", ATTR_FOLDABLE},
{"find_str", ATTR_FOLDABLE},
{"floor", ATTR_FOLDABLE},
{"flush_all", ATTR_NO_SCRIPT_SIDE_EFFECTS},

View file

@ -531,7 +531,7 @@ function strcmp%(s1: string, s2: string%): int
## Returns: The location of *little* in *big*, or 0 if *little* is not found in
## *big*.
##
## .. zeek:see:: find_all find_last
## .. zeek:see:: find_all find_first find_last
function strstr%(big: string, little: string%): count
%{
return zeek::val_mgr->Count(
@ -1015,7 +1015,7 @@ static bool exceeds_max_string_length(int str_len, int max_size, zeek::detail::F
##
## Returns: The set of strings in *str* that match *re*, or the empty set.
##
## .. zeek:see: find_all_ordered find_last strstr
## .. zeek:see: find_all_ordered find_first find_last strstr
function find_all%(str: string, re: pattern, max_str_size: int &default=-1%) : string_set
%{
auto a = zeek::make_intrusive<zeek::TableVal>(zeek::id::string_set);
@ -1055,7 +1055,7 @@ function find_all%(str: string, re: pattern, max_str_size: int &default=-1%) : s
##
## Returns: All strings in *str* that match *re*, or an empty vector.
##
## .. zeek:see: find_all find_last strstr
## .. zeek:see: find_all find_first find_last strstr
function find_all_ordered%(str: string, re: pattern, max_str_size: int &default=-1%) : string_vec
%{
auto a = zeek::make_intrusive<zeek::VectorVal>(zeek::id::string_vec);
@ -1091,7 +1091,7 @@ function find_all_ordered%(str: string, re: pattern, max_str_size: int &default=
##
## Returns: The last string in *str* that matches *re*, or the empty string.
##
## .. zeek:see: find_all find_all_ordered strstr
## .. zeek:see: find_all find_all_ordered strstr find_first
function find_last%(str: string, re: pattern%) : string
%{
const u_char* s = str->Bytes();

View file

@ -0,0 +1,4 @@
### BTest baseline data generated by btest-diff. Do not edit. Use "btest -U/-u" to update. Requires BTest >= 0.63.
hi
-------------------
0