MCPcopy Create free account
hub / github.com/CPChain/chain / TestLDBTableFuncs

Function TestLDBTableFuncs

database/leveldb_test.go:100–119  ·  view source on GitHub ↗
(t *testing.T)

Source from the content-addressed store, hash-verified

98}
99
100func TestLDBTableFuncs(t *testing.T) {
101 db, remove := newTestLDB()
102 defer remove()
103
104 tbl := database.NewTable(db, "foobar")
105 defer tbl.Close()
106
107 testDBFuncs(tbl, t)
108
109 // we use table to put
110 if err := tbl.Put([]byte("kkkk"), []byte("sss")); err != nil {
111 t.Fatalf("put failed: %v\n", err)
112 }
113 // we use db to get
114 if val, err := db.Get([]byte("foobarkkkk")); err != nil {
115 t.Fatalf("get failed: %v\n", err)
116 } else if bytes.Equal(val, []byte("ssss")) {
117 t.Fatal("value mismatch")
118 }
119}
120
121func TestLDBTableParallelFuncs(t *testing.T) {
122 db, remove := newTestLDB()

Callers

nothing calls this directly

Calls 7

newTestLDBFunction · 0.85
testDBFuncsFunction · 0.85
CloseMethod · 0.65
PutMethod · 0.65
GetMethod · 0.65
EqualMethod · 0.65
FatalMethod · 0.65

Tested by

no test coverage detected