MCPcopy Create free account
hub / github.com/33cn/chain33 / TestPluginBase

Function TestPluginBase

executor/plugin_test.go:51–74  ·  view source on GitHub ↗
(t *testing.T)

Source from the content-addressed store, hash-verified

49}
50
51func TestPluginBase(t *testing.T) {
52 exec, _ := initEnv(types.GetDefaultCfgstring())
53 base := new(pluginBase)
54 dir, ldb, kvdb := util.CreateTestDB()
55 defer util.CloseTestDB(dir, ldb)
56 ctx := &executorCtx{
57 stateHash: nil,
58 height: 0,
59 blocktime: time.Now().Unix(),
60 difficulty: 1,
61 mainHash: nil,
62 parentHash: nil,
63 }
64 executor := newExecutor(ctx, exec, kvdb, nil, nil)
65 _, _, err := base.checkFlag(executor, nil, true)
66 assert.NoError(t, err)
67
68 k := []byte("test")
69 v := types.Encode(&types.Int64{})
70 err = kvdb.Set(k, v)
71 assert.NoError(t, err)
72 _, _, err = base.checkFlag(executor, k, true)
73 assert.NoError(t, err)
74}

Callers

nothing calls this directly

Calls 8

GetDefaultCfgstringFunction · 0.92
CreateTestDBFunction · 0.92
CloseTestDBFunction · 0.92
EncodeFunction · 0.92
newExecutorFunction · 0.85
checkFlagMethod · 0.80
initEnvFunction · 0.70
SetMethod · 0.65

Tested by

no test coverage detected