File tree Expand file tree Collapse file tree 1 file changed +35
-0
lines changed Expand file tree Collapse file tree 1 file changed +35
-0
lines changed Original file line number Diff line number Diff line change @@ -20,6 +20,41 @@ import (
20
20
)
21
21
22
22
func TestWriteBlock_Basic (t * testing.T ) {
23
+ tests := []struct {
24
+ name string
25
+ block []byte
26
+ want []byte
27
+ }{
28
+ {
29
+ name : "normal write" ,
30
+ block : []byte ("hello" ),
31
+ want : []byte ("hello" ),
32
+ },
33
+ {
34
+ name : "empty block" ,
35
+ block : []byte {},
36
+ want : []byte {},
37
+ },
38
+ {
39
+ name : "nil block" ,
40
+ block : nil ,
41
+ want : []byte {},
42
+ },
43
+ }
44
+ for _ , tt := range tests {
45
+ t .Run (tt .name , func (t * testing.T ) {
46
+ db , cleanup := newTestDatabase (t , DefaultConfig ())
47
+ defer cleanup ()
48
+ require .NoError (t , db .Put (0 , tt .block ))
49
+
50
+ got , err := db .Get (0 )
51
+ require .NoError (t , err )
52
+ require .Equal (t , tt .want , got )
53
+ })
54
+ }
55
+ }
56
+
57
+ func TestWriteBlock_MaxHeight (t * testing.T ) {
23
58
customConfig := DefaultConfig ().WithMinimumHeight (10 )
24
59
25
60
tests := []struct {
You can’t perform that action at this time.
0 commit comments