@@ -101,8 +101,18 @@ function run_jsonlab_test(tests)
101101 ' {"x0x5F_i":1,"i_":"str"}' , ' compact' , 1 , ' UnpackHex' , 0 );
102102 end
103103 if (exist(' containers.Map' ))
104- test_jsonlab(' containers.Map' , @savejson , containers .Map({' Andy' , ' ^_^' }, {true , ' -_-' }), ...
104+ test_jsonlab(' containers.Map with char keys ' , @savejson , containers .Map({' Andy' , ' ^_^' }, {true , ' -_-' }), ...
105105 ' {"Andy":true,"^_^":"-_-"}' , ' compact' , 1 , ' usemap' , 1 );
106+ test_jsonlab(' containers.Map with number keys' , @savejson , containers .Map({1.1 , 1.2 }, {true , ' -_-' }), ...
107+ ' {"_MapData_":[[1.1,true],[1.2,"-_-"]]}' , ' compact' , 1 , ' usemap' , 1 );
108+ end
109+ if (exist(' dictionary' ))
110+ test_jsonlab(' dictionary with string keys' , @savejson , dictionary([" Andy" , " ^_^" ], {true , ' -_-' }), ...
111+ ' {"Andy":true,"^_^":"-_-"}' , ' compact' , 1 , ' usemap' , 1 );
112+ test_jsonlab(' dictionary with cell keys' , @savejson , dictionary({' Andy' , ' ^_^' }, {true , ' -_-' }), ...
113+ ' {"_MapData_":[["Andy",true],["^_^","-_-"]]}' , ' compact' , 1 , ' usemap' , 1 );
114+ test_jsonlab(' dictionary with number keys' , @savejson , dictionary({1.1 , 1.2 }, {true , ' -_-' }), ...
115+ ' {"_MapData_":[[1.1,true],[1.2,"-_-"]]}' , ' compact' , 1 , ' usemap' , 1 );
106116 end
107117 if (exist(' istable' ))
108118 test_jsonlab(' simple table' , @savejson , table({' Andy' , ' ^_^' }, {true , ' -_-' }), ...
@@ -238,8 +248,14 @@ function run_jsonlab_test(tests)
238248 ' {U<7>x0x5F_iU<1>U<2>i_SU<3>str}' , ' debug' , 1 , ' UnpackHex' , 0 );
239249 end
240250 if (exist(' containers.Map' ))
241- test_jsonlab(' containers.Map' , @savebj , containers .Map({' Andy' , ' ^_^' }, {true , ' -_-' }), ...
251+ test_jsonlab(' containers.Map with char keys' , @savebj , containers .Map({' Andy' , ' ^_^' }, {true , ' -_-' }), ...
252+ ' {U<4>AndyTU<3>^_^SU<3>-_-}' , ' debug' , 1 , ' usemap' , 1 );
253+ end
254+ if (exist(' dictionary' ))
255+ test_jsonlab(' dictionary with string keys' , @savebj , dictionary([" Andy" , " ^_^" ], {true , ' -_-' }), ...
242256 ' {U<4>AndyTU<3>^_^SU<3>-_-}' , ' debug' , 1 , ' usemap' , 1 );
257+ test_jsonlab(' dictionary with cell keys' , @savebj , dictionary({' Andy' , ' ^_^' }, {true , ' -_-' }), ...
258+ ' {U<4>AndyTU<3>^_^SU<3>-_-}' , ' debug' , 1 , ' usemap' , 1 );
243259 end
244260 if (exist(' istable' ))
245261 test_jsonlab(' simple table' , @savebj , table({' Andy' , ' ^_^' }, {true , ' -_-' }), ...
0 commit comments