mirror of
https://github.com/zeek/zeek.git
synced 2025-10-07 17:18:20 +00:00
[ADD] builtin function enum_to_int()
[ADD] added tests for the new enum_to_int function
This commit is contained in:
parent
9045288ad3
commit
b36d5fc81b
3 changed files with 50 additions and 0 deletions
6
testing/btest/Baseline/bifs.enum_to_int/out
Normal file
6
testing/btest/Baseline/bifs.enum_to_int/out
Normal file
|
@ -0,0 +1,6 @@
|
|||
A, 0
|
||||
B, 1
|
||||
C, 2
|
||||
AV, 10
|
||||
BV, 11
|
||||
CV, 12
|
29
testing/btest/bifs/enum_to_int.bro
Normal file
29
testing/btest/bifs/enum_to_int.bro
Normal file
|
@ -0,0 +1,29 @@
|
|||
#
|
||||
# @TEST-EXEC: bro -b %INPUT >out
|
||||
# @TEST-EXEC: btest-diff out
|
||||
|
||||
export {
|
||||
type test_enum: enum {
|
||||
A,
|
||||
B,
|
||||
C,
|
||||
};
|
||||
|
||||
type test_enum_with_val: enum {
|
||||
AV = 0xA,
|
||||
BV = 0xB,
|
||||
CV = 0xC,
|
||||
};
|
||||
}
|
||||
|
||||
event bro_init()
|
||||
{
|
||||
|
||||
|
||||
print A, enum_to_int(A);
|
||||
print B, enum_to_int(B);
|
||||
print C, enum_to_int(C);
|
||||
print AV, enum_to_int(AV);
|
||||
print BV, enum_to_int(BV);
|
||||
print CV, enum_to_int(CV);
|
||||
}
|
Loading…
Add table
Add a link
Reference in a new issue