diff --git a/ledis/t_hash_test.go b/ledis/t_hash_test.go new file mode 100644 index 0000000..ed13f2b --- /dev/null +++ b/ledis/t_hash_test.go @@ -0,0 +1,17 @@ +package ledis + +import ( + "testing" +) + +func TestDBHash(t *testing.T) { + db := getTestDB() + + key := []byte("testdb_hash_a") + + if n, err := db.HSet(key, []byte("a"), []byte("hello world")); err != nil { + t.Fatal(err) + } else if n != 1 { + t.Fatal(n) + } +} diff --git a/ledis/t_kv_test.go b/ledis/t_kv_test.go new file mode 100644 index 0000000..f041b43 --- /dev/null +++ b/ledis/t_kv_test.go @@ -0,0 +1,15 @@ +package ledis + +import ( + "testing" +) + +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) + } +} diff --git a/ledis/t_list_test.go b/ledis/t_list_test.go new file mode 100644 index 0000000..056602e --- /dev/null +++ b/ledis/t_list_test.go @@ -0,0 +1,17 @@ +package ledis + +import ( + "testing" +) + +func TestDBList(t *testing.T) { + db := getTestDB() + + key := []byte("testdb_list_a") + + if n, err := db.RPush(key, []byte("1"), []byte("2")); err != nil { + t.Fatal(err) + } else if n != 2 { + t.Fatal(n) + } +} diff --git a/ledis/t_zset_test.go b/ledis/t_zset_test.go new file mode 100644 index 0000000..fcbe32a --- /dev/null +++ b/ledis/t_zset_test.go @@ -0,0 +1,17 @@ +package ledis + +import ( + "testing" +) + +func TestDBZSet(t *testing.T) { + db := getTestDB() + + key := []byte("testdb_zset_a") + + if n, err := db.ZAdd(key, ScorePair{1, []byte("a")}, ScorePair{1, []byte("a")}); err != nil { + t.Fatal(err) + } else if n != 2 { + t.Fatal(n) + } +}