mirror of
https://github.com/zeek/zeek.git
synced 2025-10-14 04:28:20 +00:00
Add &ordered attribute for tables/sets
This commit is contained in:
parent
e3682a09e0
commit
bd7df9e2bf
9 changed files with 56 additions and 6 deletions
1
testing/btest/Baseline/language.table-iteration/.stderr
Normal file
1
testing/btest/Baseline/language.table-iteration/.stderr
Normal file
|
@ -0,0 +1 @@
|
|||
### BTest baseline data generated by btest-diff. Do not edit. Use "btest -U/-u" to update. Requires BTest >= 0.63.
|
7
testing/btest/Baseline/language.table-iteration/out
Normal file
7
testing/btest/Baseline/language.table-iteration/out
Normal file
|
@ -0,0 +1,7 @@
|
|||
### BTest baseline data generated by btest-diff. Do not edit. Use "btest -U/-u" to update. Requires BTest >= 0.63.
|
||||
2
|
||||
1
|
||||
3
|
||||
1
|
||||
2
|
||||
3
|
27
testing/btest/language/table-iteration.zeek
Normal file
27
testing/btest/language/table-iteration.zeek
Normal file
|
@ -0,0 +1,27 @@
|
|||
# @TEST-EXEC: zeek -b %INPUT >out
|
||||
# @TEST-EXEC: btest-diff out
|
||||
# @TEST-EXEC: btest-diff .stderr
|
||||
|
||||
global tbl: table[count] of count;
|
||||
global tbl2: table[count] of count &ordered;
|
||||
|
||||
event zeek_init()
|
||||
{
|
||||
local i = 0;
|
||||
while ( i < 3 )
|
||||
{
|
||||
++i;
|
||||
tbl[i] = i;
|
||||
tbl2[i] = i;
|
||||
}
|
||||
|
||||
for ( [k], v in tbl )
|
||||
{
|
||||
print(v);
|
||||
}
|
||||
|
||||
for ( [k], v in tbl2 )
|
||||
{
|
||||
print(v);
|
||||
}
|
||||
}
|
Loading…
Add table
Add a link
Reference in a new issue