fn move_cursor_to_previous_child() {
        let start_tree = json!([null, {"key": true}, false]);

        // Create and initialise Dag to test
        let arena: Arena<Json> = Arena::new();
        let root = add_value_to_arena(start_tree, &arena);

        // Create and initialise Dag to test
        let start_cursor_location = Path::from_vec(vec![]);
        let expected_cursor_location_1 = Path::from_vec(vec![0]);
        let expected_cursor_location_2 = Path::from_vec(vec![1]);
        let expected_cursor_location_3 = Path::from_vec(vec![]);
        let expected_cursor_location_4 = Path::from_vec(vec![1]);
        let expected_cursor_location_5 = Path::from_vec(vec![1, 0]);

        let mut dag = Dag::new(&arena, root, start_cursor_location);

        let ok_1 = dag.move_cursor(1, Direction::Down);
        assert_eq!(dag.current_cursor_path, expected_cursor_location_1);
        assert_eq!(ok_1, Ok(EditSuccess::Move(1, Direction::Down)));
        let ok_2 = dag.move_cursor(1, Direction::Next);
        assert_eq!(dag.current_cursor_path, expected_cursor_location_2);
        assert_eq!(ok_2, Ok(EditSuccess::Move(1, Direction::Next)));
        let ok_3 = dag.move_cursor(1, Direction::Up);
        assert_eq!(dag.current_cursor_path, expected_cursor_location_3);
        assert_eq!(ok_3, Ok(EditSuccess::Move(1, Direction::Up)));
        let ok_4 = dag.move_cursor(1, Direction::Down);
        assert_eq!(dag.current_cursor_path, expected_cursor_location_4);
        assert_eq!(ok_4, Ok(EditSuccess::Move(1, Direction::Down)));
        let ok_5 = dag.move_cursor(1, Direction::Down);
        assert_eq!(dag.current_cursor_path, expected_cursor_location_5);
        assert_eq!(ok_5, Ok(EditSuccess::Move(1, Direction::Down)));
    }
// This is the test case for issue 88
This is the test case for issue 88
This is the test case for issue 88
fn move_cursor_to_previous_child() {
        let start_tree = json!([null, {"key": true}, false]);
        // Create and initialise Dag to test
        let arena: Arena<Json> = Arena::new();
        let root = add_value_to_arena(start_tree, &arena);
        // Create and initialise Dag to test
        let start_cursor_location = Path::from_vec(vec![]);
        let expected_cursor_location_1 = Path::from_vec(vec![0]);
        let expected_cursor_location_2 = Path::from_vec(vec![1]);
        let expected_cursor_location_3 = Path::from_vec(vec![]);
        let expected_cursor_location_4 = Path::from_vec(vec![1]);
        let expected_cursor_location_5 = Path::from_vec(vec![1, 0]);
        let mut dag = Dag::new(&arena, root, start_cursor_location);
        let ok_1 = dag.move_cursor(1, Direction::Down);
        assert_eq!(dag.current_cursor_path, expected_cursor_location_1);
        assert_eq!(ok_1, Ok(EditSuccess::Move(1, Direction::Down)));
        let ok_2 = dag.move_cursor(1, Direction::Next);
        assert_eq!(dag.current_cursor_path, expected_cursor_location_2);
        assert_eq!(ok_2, Ok(EditSuccess::Move(1, Direction::Next)));
        let ok_3 = dag.move_cursor(1, Direction::Up);
        assert_eq!(dag.current_cursor_path, expected_cursor_location_3);
        assert_eq!(ok_3, Ok(EditSuccess::Move(1, Direction::Up)));
        let ok_4 = dag.move_cursor(1, Direction::Down);
        assert_eq!(dag.current_cursor_path, expected_cursor_location_4);
        assert_eq!(ok_4, Ok(EditSuccess::Move(1, Direction::Down)));
        let ok_5 = dag.move_cursor(1, Direction::Down);
        assert_eq!(dag.current_cursor_path, expected_cursor_location_5);
        assert_eq!(ok_5, Ok(EditSuccess::Move(1, Direction::Down)));
    }
fn move_cursor_to_previous_child ( ) { let start_tree = json ! ( [ null { " " true } false ] ) ; // Create and initialise Dag to test let arena : Arena < Json > = Arena :: new ( ) ; let root = add_value_to_arena ( start_tree , & arena ) ; // Create and initialise Dag to test let start_cursor_location = Path :: from_vec ( vec ! [ ] ) ; let expected_cursor_location_1 = Path :: from_vec ( vec ! [ 0 ] ) ; let expected_cursor_location_2 = Path :: from_vec ( vec ! [ 1 ] ) ; let expected_cursor_location_3 = Path :: from_vec ( vec ! [ ] ) ; let expected_cursor_location_4 = Path :: from_vec ( vec ! [ 1 ] ) ; let expected_cursor_location_5 = Path :: from_vec ( vec ! [ 1 0 ] ) ; let mut dag = Dag :: new ( & arena , root , start_cursor_location ) ; let ok_1 = dag . move_cursor ( 1 , Direction :: Down ) ; assert_eq ! ( dag current_cursor_path expected_cursor_location_1 ) ; assert_eq ! ( ok_1 Ok ( EditSuccess Move ( 1 Direction Down ) ) ) ; let ok_2 = dag . move_cursor ( 1 , Direction :: Next ) ; assert_eq ! ( dag current_cursor_path expected_cursor_location_2 ) ; assert_eq ! ( ok_2 Ok ( EditSuccess Move ( 1 Direction Next ) ) ) ; let ok_3 = dag . move_cursor ( 1 , Direction :: Up ) ; assert_eq ! ( dag current_cursor_path expected_cursor_location_3 ) ; assert_eq ! ( ok_3 Ok ( EditSuccess Move ( 1 Direction Up ) ) ) ; let ok_4 = dag . move_cursor ( 1 , Direction :: Down ) ; assert_eq ! ( dag current_cursor_path expected_cursor_location_4 ) ; assert_eq ! ( ok_4 Ok ( EditSuccess Move ( 1 Direction Down ) ) ) ; let ok_5 = dag . move_cursor ( 1 , Direction :: Down ) ; assert_eq ! ( dag current_cursor_path expected_cursor_location_5 ) ; assert_eq ! ( ok_5 Ok ( EditSuccess Move ( 1 Direction Down ) ) ) ; }
This is the test case for issue 88
This is the test case for issue 88