Blame tests/usrdef_two.sh

Packit 1422b7
# added 2015-10-30 by Rainer Gerhards
Packit 1422b7
# This file is part of the liblognorm project, released under ASL 2.0
Packit 1422b7
Packit 1422b7
. $srcdir/exec.sh
Packit 1422b7
Packit 1422b7
test_def $0 "user-defined type with two alternatives"
Packit 1422b7
add_rule 'version=2'
Packit 1422b7
add_rule 'type=@hex-byte:%f1:hexnumber{"maxval": "255"}%'
Packit 1422b7
add_rule 'type=@hex-byte:%f1:word%'
Packit 1422b7
add_rule 'rule=:a word %w1:word% a byte %   .:@hex-byte   % another word %w2:word%'
Packit 1422b7
Packit 1422b7
execute 'a word w1 a byte 0xff another word w2'
Packit 1422b7
assert_output_json_eq '{ "w2": "w2", "f1": "0xff", "w1": "w1" }'
Packit 1422b7
Packit 1422b7
execute 'a word w1 a byte TEST another word w2'
Packit 1422b7
assert_output_json_eq '{ "w2": "w2", "f1": "TEST", "w1": "w1" }'
Packit 1422b7
Packit 1422b7
cleanup_tmp_files