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

Function TestConvertNeoVmTypeHexString

smartcontract/test/common_test.go:34–57  ·  view source on GitHub ↗
(t *testing.T)

Source from the content-addressed store, hash-verified

32)
33
34func TestConvertNeoVmTypeHexString(t *testing.T) {
35 code := `00c57676c8681553797374656d2e52756e74696d652e4e6f74696679`
36
37 hex, err := common.HexToBytes(code)
38
39 if err != nil {
40 t.Fatal("hex to byte error:", err)
41 }
42
43 config := &smartcontract.Config{
44 Time: 10,
45 Height: 10,
46 Tx: nil,
47 }
48 sc := smartcontract.SmartContract{
49 Config: config,
50 Gas: 100000,
51 }
52 engine, err := sc.NewExecuteEngine(hex, types.InvokeNeo)
53
54 _, err = engine.Invoke()
55
56 assert.Error(t, err, "over max parameters convert length")
57}
58
59func BenchmarkExecuteAdd(b *testing.B) {
60 code := []byte{byte(neovm.PUSH1)}

Callers

nothing calls this directly

Calls 5

NewExecuteEngineMethod · 0.95
HexToBytesFunction · 0.92
FatalMethod · 0.80
InvokeMethod · 0.65
ErrorMethod · 0.65

Tested by

no test coverage detected