Skip to content

Commit

Permalink
fix broken tests
Browse files Browse the repository at this point in the history
  • Loading branch information
fangq committed Jun 15, 2023
1 parent 6cb5f12 commit 8f921ac
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 7 deletions.
8 changes: 4 additions & 4 deletions savejson.m
Original file line number Diff line number Diff line change
Expand Up @@ -248,13 +248,13 @@
json = sprintf('%s(%s);%s', jsonp, json, nl);
end

if(jsonopt('UTF8', 1, opt) && exist('unicode2native'))
json= unicode2native(json);
end

% save to a file if FileName is set, suggested by Patrick Rapin
filename = jsonopt('FileName', '', opt);
if (~isempty(filename))
if(jsonopt('UTF8', 1, opt) && exist('unicode2native'))
json= unicode2native(json);
end

encoding = jsonopt('Encoding', '', opt);
endian = jsonopt('Endian', 'n', opt);
mode = 'w';
Expand Down
6 changes: 3 additions & 3 deletions test/run_jsonlab_test.m
Original file line number Diff line number Diff line change
Expand Up @@ -133,13 +133,13 @@ function run_jsonlab_test(tests)
a=uint8(eye(5));
a(20,1)=1;
test_jsonlab('zlib/zip compression (level 6)',@savejson,a,...
sprintf('{"_ArrayType_":"uint8","_ArraySize_":[20,5],"_ArrayZipSize_":[1,100],"_ArrayZipType_":"zlib","_ArrayZipData_":"eJxjZAABRhwkxQBsDAACIQAH\n"}'),...
sprintf('{"_ArrayType_":"uint8","_ArraySize_":[20,5],"_ArrayZipSize_":[1,100],"_ArrayZipType_":"zlib","_ArrayZipData_":"eJxjZAABRhwkxQBsDAACIQAH"}'),...
'compact',1, 'Compression','zlib','CompressArraySize',0) % nestarray for 4-D or above is not working
test_jsonlab('gzip compression (level 6)',@savejson,a,...
sprintf('{"_ArrayType_":"uint8","_ArraySize_":[20,5],"_ArrayZipSize_":[1,100],"_ArrayZipType_":"gzip","_ArrayZipData_":"H4sIAAAAAAAAA2NkAAFGHCTFAGwMAF9Xq6VkAAAA\n"}'),...
sprintf('{"_ArrayType_":"uint8","_ArraySize_":[20,5],"_ArrayZipSize_":[1,100],"_ArrayZipType_":"gzip","_ArrayZipData_":"H4sIAAAAAAAAA2NkAAFGHCTFAGwMAF9Xq6VkAAAA"}'),...
'compact',1, 'Compression','gzip','CompressArraySize',0) % nestarray for 4-D or above is not working
test_jsonlab('lzma compression (level 5)',@savejson,a,...
sprintf('{"_ArrayType_":"uint8","_ArraySize_":[20,5],"_ArrayZipSize_":[1,100],"_ArrayZipType_":"lzma","_ArrayZipData_":"XQAAEABkAAAAAAAAAAAAgD1IirvlZSEY7DH///taoAA=\n"}'),...
sprintf('{"_ArrayType_":"uint8","_ArraySize_":[20,5],"_ArrayZipSize_":[1,100],"_ArrayZipType_":"lzma","_ArrayZipData_":"XQAAEABkAAAAAAAAAAAAgD1IirvlZSEY7DH///taoAA="}'),...
'compact',1, 'Compression','lzma','CompressArraySize',0) % nestarray for 4-D or above is not working
catch
end
Expand Down

0 comments on commit 8f921ac

Please sign in to comment.