// copies data from payload to the heap and returns it
copies data from payload to the heap and returns it
copies data from payload to the heap and returns it
fn sys_api_call_arg_data_copy() {
    with_hypervisor(|hypervisor, tmp_path| {
        assert_eq!(
            execute_update(
                &hypervisor,
                r#"
                (module
                  (import "ic0" "msg_reply" (func $msg_reply))
                  (import "ic0" "msg_reply_data_append"
                    (func $msg_reply_data_append (param i32 i32)))
                  (import "ic0" "msg_arg_data_copy"
                    (func $msg_arg_data_copy (param i32 i32 i32)))
                  (func $test
                    (call $msg_arg_data_copy
                        (i32.const 4)     ;; heap dst = 4
                        (i32.const 0)     ;; payload offset = 0
                        (i32.const 4))     ;; length = 4
                    (call $msg_reply_data_append
                        (i32.const 0)     ;; heap offset = 0
                        (i32.const 8))     ;; length = 8
                    (call $msg_reply)) ;; call reply
                  (memory (;0;) 1)
                  (export "memory" (memory 0))
                  (data (i32.const 0) "xxxxabcd")
                  (export "canister_update test" (func $test)))"#,
                "test",
                vec![121, 121, 121, 121],
                tmp_path,
            )
            .2,
            CallContextAction::Reply {
                payload: b"xxxxyyyy".to_vec(),
                refund: Cycles::from(0),
            },
        );
    });
}
fn sys_api_call_arg_data_copy ( ) { with_hypervisor ( | hypervisor , tmp_path | { assert_eq ! ( execute_update ( hypervisor r#"
                (module
                  (import "ic0" "msg_reply" (func $msg_reply))
                  (import "ic0" "msg_reply_data_append"
                    (func $msg_reply_data_append (param i32 i32)))
                  (import "ic0" "msg_arg_data_copy"
                    (func $msg_arg_data_copy (param i32 i32 i32)))
                  (func $test
                    (call $msg_arg_data_copy
                        (i32.const 4)     ;; heap dst = 4
                        (i32.const 0)     ;; payload offset = 0
                        (i32.const 4))     ;; length = 4
                    (call $msg_reply_data_append
                        (i32.const 0)     ;; heap offset = 0
                        (i32.const 8))     ;; length = 8
                    (call $msg_reply)) ;; call reply
                  (memory (;0;) 1)
                  (export "memory" (memory 0))
                  (data (i32.const 0) "xxxxabcd")
                  (export "canister_update test" (func $test)))"# " " vec [ 121 121 121 121 ] tmp_path ) 2 CallContextAction Reply { payload b" " to_vec ( ) refund Cycles from ( 0 ) } ) ; } ) ; }
copies data from payload to the heap and returns it
copies data from payload to the heap and returns it