diff options
author | Petr Štetiar <ynezz@true.cz> | 2020-01-14 11:05:02 +0300 |
---|---|---|
committer | Petr Štetiar <ynezz@true.cz> | 2020-01-20 18:54:10 +0300 |
commit | 1ffa41535369f5bb67d1eb5bdcb306671ca1d2e4 (patch) | |
tree | 2bf73fcad0d352cef827f4cd2d5008af4c36c4fb /tests/cram | |
parent | 132ecb563da794f390209c20f94d4798839dc709 (diff) |
blobmsg_json: prefer snprintf usage
Better safe than sorry and while at it prefer use of PRId16 and PRId32
formatting constants as well.
Reviewed-by: Jo-Philipp Wich <jo@mein.io>
Signed-off-by: Petr Štetiar <ynezz@true.cz>
Diffstat (limited to 'tests/cram')
-rw-r--r-- | tests/cram/test_blobmsg.t | 56 |
1 files changed, 36 insertions, 20 deletions
diff --git a/tests/cram/test_blobmsg.t b/tests/cram/test_blobmsg.t index 74ad326..0c192c5 100644 --- a/tests/cram/test_blobmsg.t +++ b/tests/cram/test_blobmsg.t @@ -16,10 +16,12 @@ check that blobmsg is producing expected results: 2147483647 (i32) -9223372036854775808 (i64) 9223372036854775807 (i64) - 133.700000 (dbl) + 0.000000 (dbl) + 179769313486231570814527423731704356798070567525844996598917476803157260780028538760589558632766878171540458953514382464234321326889464182768467546703537516986049910576551282076245490090389328944075868508455133942304583236903222948165808559332123348274797826204144723168738177180919299881250404026184124858368.000000 (dbl) } Testdata: { - \tdouble : 133.700000 (dbl) (esc) + \tdbl-min : 0.000000 (dbl) (esc) + \tdbl-max : 179769313486231570814527423731704356798070567525844996598917476803157260780028538760589558632766878171540458953514382464234321326889464182768467546703537516986049910576551282076245490090389328944075868508455133942304583236903222948165808559332123348274797826204144723168738177180919299881250404026184124858368.000000 (dbl) (esc) \tfoo : 0 (i8) (esc) \tpoo : 100 (i8) (esc) \tmoo-min : -128 (i8) (esc) @@ -33,7 +35,7 @@ check that blobmsg is producing expected results: \tworld : 2 (str) (esc) } - [*] blobmsg to json: {"message":"Hello, world!","testdata":{"double":133.700000,"foo":false,"poo":true,"moo-min":true,"moo-max":true,"bar-min":-32768,"bar-max":32767,"baz-min":-2147483648,"baz-max":2147483647,"taz-min":-9223372036854775808,"taz-max":9223372036854775807,"world":"2"},"list":[false,true,true,true,-32768,32767,-2147483648,2147483647,-9223372036854775808,9223372036854775807,133.700000]} + [*] blobmsg to json: {"message":"Hello, world!","testdata":{"dbl-min":0.000000,"dbl-max":179769313486231570814527423731704356798070567525844996598917476803157260780028538760589558632766878171540458953514382464234321326889464182768467546703537516986049910576551282076245490090389328944075868508455133942304583236903222948165808559332123348274797826204144723168738177180919299881250404026184124858368.000000,"foo":false,"poo":true,"moo-min":true,"moo-max":true,"bar-min":-32768,"bar-max":32767,"baz-min":-2147483648,"baz-max":2147483647,"taz-min":-9223372036854775808,"taz-max":9223372036854775807,"world":"2"},"list":[false,true,true,true,-32768,32767,-2147483648,2147483647,-9223372036854775808,9223372036854775807,0.000000,179769313486231570814527423731704356798070567525844996598917476803157260780028538760589558632766878171540458953514382464234321326889464182768467546703537516986049910576551282076245490090389328944075868508455133942304583236903222948165808559332123348274797826204144723168738177180919299881250404026184124858368.000000]} [*] blobmsg from json: Message: Hello, world! @@ -48,10 +50,12 @@ check that blobmsg is producing expected results: 2147483647 (i32) -9223372036854775808 (i64) 9223372036854775807 (i64) - 133.700000 (dbl) + 0.000000 (dbl) + 179769313486231570814527423731704356798070567525844996598917476803157260780028538760589558632766878171540458953514382464234321326889464182768467546703537516986049910576551282076245490090389328944075868508455133942304583236903222948165808559332123348274797826204144723168738177180919299881250404026184124858368.000000 (dbl) } Testdata: { - \tdouble : 133.700000 (dbl) (esc) + \tdbl-min : 0.000000 (dbl) (esc) + \tdbl-max : 179769313486231570814527423731704356798070567525844996598917476803157260780028538760589558632766878171540458953514382464234321326889464182768467546703537516986049910576551282076245490090389328944075868508455133942304583236903222948165808559332123348274797826204144723168738177180919299881250404026184124858368.000000 (dbl) (esc) \tfoo : 0 (i8) (esc) \tpoo : 1 (i8) (esc) \tmoo-min : 1 (i8) (esc) @@ -79,10 +83,12 @@ check that blobmsg is producing expected results: 2147483647 (i32) -9223372036854775808 (i64) 9223372036854775807 (i64) - 133.700000 (dbl) + 0.000000 (dbl) + 179769313486231570814527423731704356798070567525844996598917476803157260780028538760589558632766878171540458953514382464234321326889464182768467546703537516986049910576551282076245490090389328944075868508455133942304583236903222948165808559332123348274797826204144723168738177180919299881250404026184124858368.000000 (dbl) } Testdata: { - \tdouble : 133.700000 (dbl) (esc) + \tdbl-min : 0.000000 (dbl) (esc) + \tdbl-max : 179769313486231570814527423731704356798070567525844996598917476803157260780028538760589558632766878171540458953514382464234321326889464182768467546703537516986049910576551282076245490090389328944075868508455133942304583236903222948165808559332123348274797826204144723168738177180919299881250404026184124858368.000000 (dbl) (esc) \tfoo : 0 (i8) (esc) \tpoo : 100 (i8) (esc) \tmoo-min : -128 (i8) (esc) @@ -96,7 +102,7 @@ check that blobmsg is producing expected results: \tworld : 2 (str) (esc) } - [*] blobmsg to json: {"message":"Hello, world!","testdata":{"double":133.700000,"foo":false,"poo":true,"moo-min":true,"moo-max":true,"bar-min":-32768,"bar-max":32767,"baz-min":-2147483648,"baz-max":2147483647,"taz-min":-9223372036854775808,"taz-max":9223372036854775807,"world":"2"},"list":[false,true,true,true,-32768,32767,-2147483648,2147483647,-9223372036854775808,9223372036854775807,133.700000]} + [*] blobmsg to json: {"message":"Hello, world!","testdata":{"dbl-min":0.000000,"dbl-max":179769313486231570814527423731704356798070567525844996598917476803157260780028538760589558632766878171540458953514382464234321326889464182768467546703537516986049910576551282076245490090389328944075868508455133942304583236903222948165808559332123348274797826204144723168738177180919299881250404026184124858368.000000,"foo":false,"poo":true,"moo-min":true,"moo-max":true,"bar-min":-32768,"bar-max":32767,"baz-min":-2147483648,"baz-max":2147483647,"taz-min":-9223372036854775808,"taz-max":9223372036854775807,"world":"2"},"list":[false,true,true,true,-32768,32767,-2147483648,2147483647,-9223372036854775808,9223372036854775807,0.000000,179769313486231570814527423731704356798070567525844996598917476803157260780028538760589558632766878171540458953514382464234321326889464182768467546703537516986049910576551282076245490090389328944075868508455133942304583236903222948165808559332123348274797826204144723168738177180919299881250404026184124858368.000000]} [*] blobmsg from json: Message: Hello, world! @@ -111,10 +117,12 @@ check that blobmsg is producing expected results: 2147483647 (i32) -9223372036854775808 (i64) 9223372036854775807 (i64) - 133.700000 (dbl) + 0.000000 (dbl) + 179769313486231570814527423731704356798070567525844996598917476803157260780028538760589558632766878171540458953514382464234321326889464182768467546703537516986049910576551282076245490090389328944075868508455133942304583236903222948165808559332123348274797826204144723168738177180919299881250404026184124858368.000000 (dbl) } Testdata: { - \tdouble : 133.700000 (dbl) (esc) + \tdbl-min : 0.000000 (dbl) (esc) + \tdbl-max : 179769313486231570814527423731704356798070567525844996598917476803157260780028538760589558632766878171540458953514382464234321326889464182768467546703537516986049910576551282076245490090389328944075868508455133942304583236903222948165808559332123348274797826204144723168738177180919299881250404026184124858368.000000 (dbl) (esc) \tfoo : 0 (i8) (esc) \tpoo : 1 (i8) (esc) \tmoo-min : 1 (i8) (esc) @@ -142,10 +150,12 @@ check that blobmsg is producing expected results: 2147483647 (i32) -9223372036854775808 (i64) 9223372036854775807 (i64) - 133.700000 (dbl) + 0.000000 (dbl) + 179769313486231570814527423731704356798070567525844996598917476803157260780028538760589558632766878171540458953514382464234321326889464182768467546703537516986049910576551282076245490090389328944075868508455133942304583236903222948165808559332123348274797826204144723168738177180919299881250404026184124858368.000000 (dbl) } Testdata: { - \tdouble : 133.700000 (dbl) (esc) + \tdbl-min : 0.000000 (dbl) (esc) + \tdbl-max : 179769313486231570814527423731704356798070567525844996598917476803157260780028538760589558632766878171540458953514382464234321326889464182768467546703537516986049910576551282076245490090389328944075868508455133942304583236903222948165808559332123348274797826204144723168738177180919299881250404026184124858368.000000 (dbl) (esc) \tfoo : 0 (i8) (esc) \tpoo : 100 (i8) (esc) \tmoo-min : -128 (i8) (esc) @@ -159,7 +169,7 @@ check that blobmsg is producing expected results: \tworld : 2 (str) (esc) } - [*] blobmsg to json: {"message":"Hello, world!","testdata":{"double":133.700000,"foo":false,"poo":true,"moo-min":true,"moo-max":true,"bar-min":-32768,"bar-max":32767,"baz-min":-2147483648,"baz-max":2147483647,"taz-min":-9223372036854775808,"taz-max":9223372036854775807,"world":"2"},"list":[false,true,true,true,-32768,32767,-2147483648,2147483647,-9223372036854775808,9223372036854775807,133.700000]} + [*] blobmsg to json: {"message":"Hello, world!","testdata":{"dbl-min":0.000000,"dbl-max":179769313486231570814527423731704356798070567525844996598917476803157260780028538760589558632766878171540458953514382464234321326889464182768467546703537516986049910576551282076245490090389328944075868508455133942304583236903222948165808559332123348274797826204144723168738177180919299881250404026184124858368.000000,"foo":false,"poo":true,"moo-min":true,"moo-max":true,"bar-min":-32768,"bar-max":32767,"baz-min":-2147483648,"baz-max":2147483647,"taz-min":-9223372036854775808,"taz-max":9223372036854775807,"world":"2"},"list":[false,true,true,true,-32768,32767,-2147483648,2147483647,-9223372036854775808,9223372036854775807,0.000000,179769313486231570814527423731704356798070567525844996598917476803157260780028538760589558632766878171540458953514382464234321326889464182768467546703537516986049910576551282076245490090389328944075868508455133942304583236903222948165808559332123348274797826204144723168738177180919299881250404026184124858368.000000]} [*] blobmsg from json: Message: Hello, world! @@ -174,10 +184,12 @@ check that blobmsg is producing expected results: 2147483647 (i32) -9223372036854775808 (i64) 9223372036854775807 (i64) - 133.700000 (dbl) + 0.000000 (dbl) + 179769313486231570814527423731704356798070567525844996598917476803157260780028538760589558632766878171540458953514382464234321326889464182768467546703537516986049910576551282076245490090389328944075868508455133942304583236903222948165808559332123348274797826204144723168738177180919299881250404026184124858368.000000 (dbl) } Testdata: { - \tdouble : 133.700000 (dbl) (esc) + \tdbl-min : 0.000000 (dbl) (esc) + \tdbl-max : 179769313486231570814527423731704356798070567525844996598917476803157260780028538760589558632766878171540458953514382464234321326889464182768467546703537516986049910576551282076245490090389328944075868508455133942304583236903222948165808559332123348274797826204144723168738177180919299881250404026184124858368.000000 (dbl) (esc) \tfoo : 0 (i8) (esc) \tpoo : 1 (i8) (esc) \tmoo-min : 1 (i8) (esc) @@ -205,10 +217,12 @@ check that blobmsg is producing expected results: 2147483647 (i32) -9223372036854775808 (i64) 9223372036854775807 (i64) - 133.700000 (dbl) + 0.000000 (dbl) + 179769313486231570814527423731704356798070567525844996598917476803157260780028538760589558632766878171540458953514382464234321326889464182768467546703537516986049910576551282076245490090389328944075868508455133942304583236903222948165808559332123348274797826204144723168738177180919299881250404026184124858368.000000 (dbl) } Testdata: { - \tdouble : 133.700000 (dbl) (esc) + \tdbl-min : 0.000000 (dbl) (esc) + \tdbl-max : 179769313486231570814527423731704356798070567525844996598917476803157260780028538760589558632766878171540458953514382464234321326889464182768467546703537516986049910576551282076245490090389328944075868508455133942304583236903222948165808559332123348274797826204144723168738177180919299881250404026184124858368.000000 (dbl) (esc) \tfoo : 0 (i8) (esc) \tpoo : 100 (i8) (esc) \tmoo-min : -128 (i8) (esc) @@ -222,7 +236,7 @@ check that blobmsg is producing expected results: \tworld : 2 (str) (esc) } - [*] blobmsg to json: {"message":"Hello, world!","testdata":{"double":133.700000,"foo":false,"poo":true,"moo-min":true,"moo-max":true,"bar-min":-32768,"bar-max":32767,"baz-min":-2147483648,"baz-max":2147483647,"taz-min":-9223372036854775808,"taz-max":9223372036854775807,"world":"2"},"list":[false,true,true,true,-32768,32767,-2147483648,2147483647,-9223372036854775808,9223372036854775807,133.700000]} + [*] blobmsg to json: {"message":"Hello, world!","testdata":{"dbl-min":0.000000,"dbl-max":179769313486231570814527423731704356798070567525844996598917476803157260780028538760589558632766878171540458953514382464234321326889464182768467546703537516986049910576551282076245490090389328944075868508455133942304583236903222948165808559332123348274797826204144723168738177180919299881250404026184124858368.000000,"foo":false,"poo":true,"moo-min":true,"moo-max":true,"bar-min":-32768,"bar-max":32767,"baz-min":-2147483648,"baz-max":2147483647,"taz-min":-9223372036854775808,"taz-max":9223372036854775807,"world":"2"},"list":[false,true,true,true,-32768,32767,-2147483648,2147483647,-9223372036854775808,9223372036854775807,0.000000,179769313486231570814527423731704356798070567525844996598917476803157260780028538760589558632766878171540458953514382464234321326889464182768467546703537516986049910576551282076245490090389328944075868508455133942304583236903222948165808559332123348274797826204144723168738177180919299881250404026184124858368.000000]} [*] blobmsg from json: Message: Hello, world! @@ -237,10 +251,12 @@ check that blobmsg is producing expected results: 2147483647 (i32) -9223372036854775808 (i64) 9223372036854775807 (i64) - 133.700000 (dbl) + 0.000000 (dbl) + 179769313486231570814527423731704356798070567525844996598917476803157260780028538760589558632766878171540458953514382464234321326889464182768467546703537516986049910576551282076245490090389328944075868508455133942304583236903222948165808559332123348274797826204144723168738177180919299881250404026184124858368.000000 (dbl) } Testdata: { - \tdouble : 133.700000 (dbl) (esc) + \tdbl-min : 0.000000 (dbl) (esc) + \tdbl-max : 179769313486231570814527423731704356798070567525844996598917476803157260780028538760589558632766878171540458953514382464234321326889464182768467546703537516986049910576551282076245490090389328944075868508455133942304583236903222948165808559332123348274797826204144723168738177180919299881250404026184124858368.000000 (dbl) (esc) \tfoo : 0 (i8) (esc) \tpoo : 1 (i8) (esc) \tmoo-min : 1 (i8) (esc) |