mirror of
https://github.com/zeek/zeek.git
synced 2025-10-02 14:48:21 +00:00
Add conversion between set and vector using 'as' keyword
This commit is contained in:
parent
59f7b26b51
commit
af9e852c28
8 changed files with 157 additions and 0 deletions
24
testing/btest/language/vector-set-conversions-errors.zeek
Normal file
24
testing/btest/language/vector-set-conversions-errors.zeek
Normal file
|
@ -0,0 +1,24 @@
|
|||
# @TEST-DOC: Test error cases while converting between sets and vectorswith the 'as' keyword
|
||||
# @TEST-EXEC-FAIL: zeek -b %INPUT > out
|
||||
# @TEST-EXEC: btest-diff out
|
||||
# @TEST-EXEC: TEST_DIFF_CANONIFIER="$SCRIPTS/diff-remove-abspath" btest-diff .stderr
|
||||
|
||||
print("vector to set: type mismatch");
|
||||
local v1 = vector(1, 1, 1, 2, 2, 3, 3, 4);
|
||||
local s1 = v1 as set[addr];
|
||||
print(v1);
|
||||
print(s1);
|
||||
|
||||
print("");
|
||||
print("set to vector: type mismatch");
|
||||
local s2 = set(1, 2, 3, 4);
|
||||
local v2 = s2 as vector of addr;
|
||||
print(s2);
|
||||
print(v2);
|
||||
|
||||
print("");
|
||||
print("set to vector: multiple indices");
|
||||
local s3: set[port,string] = { [21/tcp, "ftp"], [23/tcp, "telnet"] };
|
||||
local v3 = s3 as vector of port;
|
||||
print(s3);
|
||||
print(v3);
|
Loading…
Add table
Add a link
Reference in a new issue