| 1 | #!/bin/bashscip-shell filesystem . . `/bin/bash`. |
| 2 | # added 2017-10-02 by Rainer Gerhards |
| 3 | # This file is part of the liblognorm project, released under ASL 2.0 |
| 4 | |
| 5 | . $srcdir/exec.sh |
| 6 | |
| 7 | test_def $0 "hexnumber field" |
| 8 | add_rule 'version=2' |
| 9 | add_rule 'rule=:here is a number %{ "type":"hexnumber", "name":"num", "format":"number"} % in hex form' |
| 10 | execute 'here is a number 0x1234 in hex form' |
| 11 | assert_output_json_eq '{"num": 4660}' |
| 12 | |
| 13 | #check cases where parsing failure must occur |
| 14 | execute 'here is a number 0x1234in hex form' |
| 15 | assert_output_json_eq '{ "originalmsg": "here is a number 0x1234in hex form", "unparsed-data": "0x1234in hex form" }' |
| 16 | |
| 17 | |
| 18 | cleanup_tmp_files |
| 19 |