forked from tecbot/gorocksdb
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathdb_6_test.go
More file actions
48 lines (35 loc) · 1.18 KB
/
db_6_test.go
File metadata and controls
48 lines (35 loc) · 1.18 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
// +build !rocksdb_6_16
package gorocksdb
import (
"testing"
"github.com/facebookgo/ensure"
)
func TestDBGetApproximateSizes(t *testing.T) {
db := newTestDB(t, "TestDBGetApproximateSizes", nil)
defer db.Close()
// no ranges
sizes := db.GetApproximateSizes(nil)
ensure.DeepEqual(t, len(sizes), 0)
// range will nil start and limit
sizes = db.GetApproximateSizes([]Range{{Start: nil, Limit: nil}})
ensure.DeepEqual(t, sizes, []uint64{0})
// valid range
sizes = db.GetApproximateSizes([]Range{{Start: []byte{0x00}, Limit: []byte{0xFF}}})
ensure.DeepEqual(t, sizes, []uint64{0})
}
func TestDBGetApproximateSizesCF(t *testing.T) {
db := newTestDB(t, "TestDBGetApproximateSizesCF", nil)
defer db.Close()
o := NewDefaultOptions()
cf, err := db.CreateColumnFamily(o, "other")
ensure.Nil(t, err)
// no ranges
sizes := db.GetApproximateSizesCF(cf, nil)
ensure.DeepEqual(t, len(sizes), 0)
// range will nil start and limit
sizes = db.GetApproximateSizesCF(cf, []Range{{Start: nil, Limit: nil}})
ensure.DeepEqual(t, sizes, []uint64{0})
// valid range
sizes = db.GetApproximateSizesCF(cf, []Range{{Start: []byte{0x00}, Limit: []byte{0xFF}}})
ensure.DeepEqual(t, sizes, []uint64{0})
}