libubox: tests: add more blobmsg/json test cases
[project/libubox.git] / tests / cram / test_blobmsg_types.t
1 check that blobmsg is producing expected results:
2
3 $ [ -n "$TEST_BIN_DIR" ] && export PATH="$TEST_BIN_DIR:$PATH"
4
5 $ valgrind --quiet --leak-check=full test-blobmsg-types
6 [*] blobmsg dump:
7 string: Hello, world!
8 int64_max: 9223372036854775807
9 int64_min: -9223372036854775808
10 int32_max: 2147483647
11 int32_min: -2147483648
12 int16_max: 32767
13 int16_min: -32768
14 int8_max: 127
15 int8_min: -128
16 double_max: 1.797693e+308
17 double_min: 2.225074e-308
18 [*] blobmsg dump cast_u64:
19 string: Hello, world!
20 int64_max: 9223372036854775807
21 int64_min: 9223372036854775808
22 int32_max: 2147483647
23 int32_min: 2147483648
24 int16_max: 32767
25 int16_min: 32768
26 int8_max: 127
27 int8_min: 128
28 double_max: 1.797693e+308
29 double_min: 2.225074e-308
30 [*] blobmsg dump cast_s64:
31 string: Hello, world!
32 int64_max: 9223372036854775807
33 int64_min: -9223372036854775808
34 int32_max: 2147483647
35 int32_min: -2147483648
36 int16_max: 32767
37 int16_min: -32768
38 int8_max: 127
39 int8_min: -128
40 double_max: 1.797693e+308
41 double_min: 2.225074e-308
42
43 [*] blobmsg to json: {"string":"Hello, world!","int64_max":9223372036854775807,"int64_min":-9223372036854775808,"int32_max":2147483647,"int32_min":-2147483648,"int16_max":32767,"int16_min":-32768,"int8_max":true,"int8_min":true,"double_max":179769313486231570814527423731704356798070567525844996598917476803157260780028538760589558632766878171540458953514382464234321326889464182768467546703537516986049910576551282076245490090389328944075868508455133942304583236903222948165808559332123348274797826204144723168738177180919299881250404026184124858368.000000,"double_min":0.000000}
44
45 [*] blobmsg from json:
46 string: Hello, world!
47 int64_max: 9223372036854775807
48 int64_min: -9223372036854775808
49 int32_max: 2147483647
50 int32_min: -2147483648
51 int16_max: 32767
52 int16_min: -32768
53 int8_max: 1
54 int8_min: 1
55 double_max: 1.797693e+308
56 double_min: 0.000000e+00
57
58 [*] blobmsg from json/cast_u64:
59 string: Hello, world!
60 int64_max: 9223372036854775807
61 int64_min: 9223372036854775808
62 int32_max: 2147483647
63 int32_min: 2147483648
64 int16_max: 32767
65 int16_min: 4294934528
66 int8_max: 1
67 int8_min: 1
68 double_max: 1.797693e+308
69 double_min: 0.000000e+00
70
71 [*] blobmsg from json/cast_s64:
72 string: Hello, world!
73 int64_max: 9223372036854775807
74 int64_min: -9223372036854775808
75 int32_max: 2147483647
76 int32_min: -2147483648
77 int16_max: 32767
78 int16_min: -32768
79 int8_max: 1
80 int8_min: 1
81 double_max: 1.797693e+308
82 double_min: 0.000000e+00