File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -266,6 +266,30 @@ bool navigate_test() {
266266 printf (" Root should be object\n " );
267267 return false ;
268268 }
269+ if (pjh.move_to_key (" bad key" )) {
270+ printf (" We should not move to a non-existing key\n " );
271+ return false ;
272+ }
273+ if (!pjh.is_object ()) {
274+ printf (" We should have remained at the object.\n " );
275+ return false ;
276+ }
277+ if (pjh.move_to_key_insensitive (" bad key" )) {
278+ printf (" We should not move to a non-existing key\n " );
279+ return false ;
280+ }
281+ if (!pjh.is_object ()) {
282+ printf (" We should have remained at the object.\n " );
283+ return false ;
284+ }
285+ if (pjh.move_to_key (" bad key" , 7 )) {
286+ printf (" We should not move to a non-existing key\n " );
287+ return false ;
288+ }
289+ if (!pjh.is_object ()) {
290+ printf (" We should have remained at the object.\n " );
291+ return false ;
292+ }
269293 if (!pjh.down ()) {
270294 printf (" Root should not be emtpy\n " );
271295 return false ;
@@ -303,6 +327,25 @@ bool navigate_test() {
303327 printf (" There should be a key Width.\n " );
304328 return false ;
305329 }
330+ if (!pjh.up ()) {
331+ return false ;
332+ }
333+ if (!pjh.move_to_key (" IDs" )) {
334+ printf (" We should be able to move to an existing key\n " );
335+ return false ;
336+ }
337+ if (!pjh.is_array ()) {
338+ printf (" Value of IDs should be array, it is %c \n " , pjh.get_type ());
339+ return false ;
340+ }
341+ if (pjh.move_to_index (4 )) {
342+ printf (" We should not be able to move to a non-existing index\n " );
343+ return false ;
344+ }
345+ if (!pjh.is_array ()) {
346+ printf (" We should have remained at the array\n " );
347+ return false ;
348+ }
306349 return true ;
307350}
308351
You can’t perform that action at this time.
0 commit comments