Mercurial > octave
diff libinterp/corefcn/jsonencode.cc @ 28761:b5461b1dc0ca
Review jsonecode/jsondecode BIST tests.
* test/json/jsondecode_BIST.tst: Renamed file from "jsondecodetest.tst".
* test/json/jsonencode_BIST.tst: Renamed file from "jsonencodetest.tst".
* test/json/module.mk: Update build system with new file names.
* jsondecode_BIST.tst, jsonencode_BIST.tst: Use "obs" as variable name for
observed result. Use Octave convention of two leading comment characters
for full-line comments. Test explicitly for class of decoded logical
values as isequal() does not do that. Add FIXME about jsondecode failure
to decode logical array. Shorten lines to mostly be less than 80 characters.
Add tests for Octave-specific value 'NA' for jsonencode. Add FIXME about
Matlab compatibility with double quoted strings and jsonencode. Remove
duplicated %!testif block. Add FIXME to jsonencode_BIST.tst about need
for tests with "PrettyWriter" set to true.
* jsondecode.cc: Add note that functional BIST tests are not located
with the code in this file, but in the file jsondecode_BIST.tst.
* jsonencode.cc: Add note that functional BIST tests are not located
with the code in this file, but in the file jsonencode_BIST.tst.
Change wording of documentation about preserving array dimensions.
Wrap long lines in input validation BIST tests.
author | Rik <rik@octave.org> |
---|---|
date | Fri, 18 Sep 2020 13:02:43 -0700 |
parents | f4ed4be5d809 |
children | d28016d16e9a |
line wrap: on
line diff
--- a/libinterp/corefcn/jsonencode.cc Fri Sep 18 11:58:38 2020 -0700 +++ b/libinterp/corefcn/jsonencode.cc Fri Sep 18 13:02:43 2020 -0700 @@ -477,8 +477,7 @@ @item Encoding and decoding an array is not guaranteed to preserve the dimensions -of the array. For example, if a row vector is encoded and decoded then the -result will be a column vector. +of the array. In particular, row vectors will be reshaped to column vectors. @item Encoding and decoding is not guaranteed to preserve the Octave data type @@ -643,9 +642,7 @@ } /* -FIXME: Need BIST tests for encoding each data type -##%!testif HAVE_RAPIDJSON - +Functional BIST tests are located in test/json/jsonencode_BIST.tst ## Input validation tests %!testif HAVE_RAPIDJSON @@ -654,8 +651,10 @@ %! fail ("jsonencode (1, 2, 3, 4)"); %! fail ("jsonencode (1, 2, 3, 4, 5, 6)"); %! fail ("jsonencode (1, 2, true)", "option must be a string"); -%! fail ("jsonencode (1, 'string', ones (2,2))", "option value must be a logical scalar"); -%! fail ("jsonencode (1, 'foobar', true)", 'Valid options are "ConvertInfAndNaN"'); +%! fail ("jsonencode (1, 'string', ones (2,2))", ... +%! "option value must be a logical scalar"); +%! fail ("jsonencode (1, 'foobar', true)", ... +%! 'Valid options are "ConvertInfAndNaN"'); %!testif HAVE_RAPIDJSON; ! __have_feature__ ("RAPIDJSON_PRETTYWRITER") %! fail ("jsonencode (1, 'PrettyWriter', true)", ...