File: field_float_jsoncnf.sh

package info (click to toggle)
liblognorm 2.0.9-1
  • links: PTS, VCS
  • area: main
  • in suites: forky, sid
  • size: 1,696 kB
  • sloc: ansic: 11,634; sh: 2,639; makefile: 255; python: 34
file content (28 lines) | stat: -rwxr-xr-x 799 bytes parent folder | download | duplicates (3)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
#!/bin/bash
# added 2015-02-25 by singh.janmejay
# This file is part of the liblognorm project, released under ASL 2.0
. $srcdir/exec.sh

test_def $0 "float field"
add_rule 'version=2'
add_rule 'rule=:here is a number %{"name":"num", "type":"float"}% in floating pt form'
execute 'here is a number 15.9 in floating pt form'
assert_output_json_eq '{"num": "15.9"}'

reset_rules

add_rule 'version=2'
add_rule 'rule=:here is a negative number %{"name":"num", "type":"float"}% for you'
execute 'here is a negative number -4.2 for you'
assert_output_json_eq '{"num": "-4.2"}'

reset_rules

add_rule 'version=2'
add_rule 'rule=:here is another real number %{"name":"real_no", "type":"float"}%.'
execute 'here is another real number 2.71.'
assert_output_json_eq '{"real_no": "2.71"}'


cleanup_tmp_files