2021-12-07 02:36:12 +01:00
|
|
|
package db
|
|
|
|
|
|
|
|
import (
|
|
|
|
"testing"
|
|
|
|
)
|
|
|
|
|
|
|
|
// TestOpenDB test to see if we can open a db
|
|
|
|
func TestOpenDB(t *testing.T) {
|
|
|
|
|
|
|
|
tests := []struct {
|
|
|
|
name string
|
2021-12-07 12:45:18 +01:00
|
|
|
want int
|
2021-12-07 02:36:12 +01:00
|
|
|
}{
|
|
|
|
{
|
|
|
|
name: "Open a rocksdb database",
|
2021-12-07 12:45:18 +01:00
|
|
|
want: 10,
|
2021-12-07 02:36:12 +01:00
|
|
|
},
|
|
|
|
}
|
|
|
|
|
|
|
|
for _, tt := range tests {
|
|
|
|
t.Run(tt.name, func(t *testing.T) {
|
2021-12-07 12:45:18 +01:00
|
|
|
vals := OpenDB("../resources/tmp.db")
|
|
|
|
got := vals
|
2021-12-07 02:36:12 +01:00
|
|
|
|
|
|
|
if got != tt.want {
|
2021-12-07 12:45:18 +01:00
|
|
|
t.Errorf("got: %d, want: %d\n", got, tt.want)
|
2021-12-07 02:36:12 +01:00
|
|
|
}
|
|
|
|
})
|
|
|
|
}
|
|
|
|
|
|
|
|
}
|