1
0
forked from MTSR/mapserver
mapserver/tiledb/tiledb_test.go
2019-06-13 08:04:32 +02:00

49 lines
656 B
Go

package tiledb
import (
"io/ioutil"
"mapserver/coords"
"os"
"testing"
)
func TestTileDB(t *testing.T) {
tmpfile, err := ioutil.TempDir("", "TestTileDB")
if err != nil {
panic(err)
}
defer os.RemoveAll(tmpfile)
db, err := New(tmpfile)
if err != nil {
panic(err)
}
c := coords.NewTileCoords(0, 0, 1, 2)
err = db.SetTile(c, []byte{1, 2, 3})
if err != nil {
panic(err)
}
tile, err := db.GetTile(c)
if err != nil {
panic(err)
}
if len(tile) != 3 {
t.Error("wrong size")
}
c2 := coords.NewTileCoords(1, 0, 1, 2)
tile, err = db.GetTile(c2)
if err != nil {
panic(err)
}
if tile != nil {
t.Error("tile exists")
}
}