fn sys_api_call_out_of_cycles() {
    with_hypervisor(|hypervisor, tmp_path| {
        // this is not enough for 4 instructions
        assert_eq!(
            execute_update_with_cycles_memory_time(
                &hypervisor,
                r#"
                (module
                  (func (;0;)
                    (i32.const 0)
                    (i32.const 0)
                    (drop)
                    (drop))
                  (export "canister_update test" (func 0)))"#,
                "test",
                EMPTY_PAYLOAD,
                None,
                None,
                // this is not enough for 4 instructions
                NumInstructions::from(3),
                MEMORY_ALLOCATION,
                mock_time(),
                tmp_path,
            )
            .2,
            CallContextAction::Fail {
                error: HypervisorError::InstructionLimitExceeded,
                refund: Cycles::from(0),
            }
        );
    });
}
// sets cycles to a too small number, provokes an out of cycles error
sets cycles to a too small number, provokes an out of cycles error
sets cycles to a too small number provokes an out of cycles error
fn sys_api_call_out_of_cycles() {
    with_hypervisor(|hypervisor, tmp_path| {
        // this is not enough for 4 instructions
        assert_eq!(
            execute_update_with_cycles_memory_time(
                &hypervisor,
                r#"
                (module
                  (func (;0;)
                    (i32.const 0)
                    (i32.const 0)
                    (drop)
                    (drop))
                  (export "canister_update test" (func 0)))"#,
                "test",
                EMPTY_PAYLOAD,
                None,
                None,
                // this is not enough for 4 instructions
                NumInstructions::from(3),
                MEMORY_ALLOCATION,
                mock_time(),
                tmp_path,
            )
            .2,
            CallContextAction::Fail {
                error: HypervisorError::InstructionLimitExceeded,
                refund: Cycles::from(0),
            }
        );
    });
}
fn sys_api_call_out_of_cycles ( ) { with_hypervisor ( | hypervisor , tmp_path | { // this is not enough for 4 instructions assert_eq ! ( execute_update_with_cycles_memory_time ( hypervisor r#"
                (module
                  (func (;0;)
                    (i32.const 0)
                    (i32.const 0)
                    (drop)
                    (drop))
                  (export "canister_update test" (func 0)))"# " " EMPTY_PAYLOAD None None // this is not enough for 4 instructions NumInstructions from ( 3 ) MEMORY_ALLOCATION mock_time ( ) tmp_path ) 2 CallContextAction Fail { error HypervisorError InstructionLimitExceeded refund Cycles from ( 0 ) } ) ; } ) ; }
sets cycles to a too small number, provokes an out of cycles error
sets cycles to a too small number provokes an out of cycles error