forked from mirror/ledisdb
28 lines
411 B
Go
28 lines
411 B
Go
package ledis
|
|
|
|
import (
|
|
"testing"
|
|
)
|
|
|
|
func TestKVCodec(t *testing.T) {
|
|
db := getTestDB()
|
|
|
|
ek := db.encodeKVKey([]byte("key"))
|
|
|
|
if k, err := db.decodeKVKey(ek); err != nil {
|
|
t.Fatal(err)
|
|
} else if string(k) != "key" {
|
|
t.Fatal(string(k))
|
|
}
|
|
}
|
|
|
|
func TestDBKV(t *testing.T) {
|
|
db := getTestDB()
|
|
|
|
key := []byte("testdb_kv_a")
|
|
|
|
if err := db.Set(key, []byte("hello world")); err != nil {
|
|
t.Fatal(err)
|
|
}
|
|
}
|