MCPcopy Create free account
hub / github.com/DNAProject/DNA / buildNeoVmValueFromExpect

Function buildNeoVmValueFromExpect

wasmtest/wasm-test.go:372–408  ·  view source on GitHub ↗
(expectlist []interface{})

Source from the content-addressed store, hash-verified

370}
371
372func buildNeoVmValueFromExpect(expectlist []interface{}) *vmtypes.VmValue {
373 if len(expectlist) > 1 {
374 panic("only support return one value")
375 }
376 expect := expectlist[0]
377
378 switch expect.(type) {
379 case string:
380 val, err := vmtypes.VmValueFromBytes([]byte(expect.(string)))
381 if err != nil {
382 panic(err)
383 }
384 return &val
385 case []byte:
386 val, err := vmtypes.VmValueFromBytes(expect.([]byte))
387 if err != nil {
388 panic(err)
389 }
390 return &val
391 case int64:
392 val := vmtypes.VmValueFromInt64(expect.(int64))
393 return &val
394 case bool:
395 val := vmtypes.VmValueFromBool(expect.(bool))
396 return &val
397 case common.Address:
398 addr := expect.(common.Address)
399 val, err := vmtypes.VmValueFromBytes(addr[:])
400 if err != nil {
401 panic(err)
402 }
403 return &val
404 default:
405 fmt.Printf("unspport param type %s", reflect.TypeOf(expect))
406 panic("unspport param type")
407 }
408}
409
410func GenAccounts(num int) []*account.Account {
411 var accounts []*account.Account

Callers 1

checkExecResultFunction · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected