github.com/cayleygraph/cayley@v0.7.7/graph/sql/sqlite/sqlite_test.go (about)

     1  //+build cgo
     2  
     3  package sqlite
     4  
     5  import (
     6  	"fmt"
     7  	"io/ioutil"
     8  	"os"
     9  	"testing"
    10  
    11  	"github.com/cayleygraph/cayley/graph"
    12  	"github.com/cayleygraph/cayley/graph/sql/sqltest"
    13  )
    14  
    15  func makeSqlite(t testing.TB) (string, graph.Options, func()) {
    16  	tmpFile, err := ioutil.TempFile("", fmt.Sprintf("cayley_test_%s*", Type))
    17  	if err != nil {
    18  		t.Fatalf("Could not create working directory: %v", err)
    19  	}
    20  	return fmt.Sprintf("file:%s?_loc=UTC", tmpFile.Name()), nil, func() {
    21  		os.RemoveAll(tmpFile.Name())
    22  	}
    23  }
    24  
    25  var conf = &sqltest.Config{
    26  	TimeRound: true,
    27  	TimeInMcs: false,
    28  }
    29  
    30  func TestSqlite(t *testing.T) {
    31  	sqltest.TestAll(t, Type, makeSqlite, conf)
    32  }
    33  
    34  func BenchmarkSqlite(t *testing.B) {
    35  	sqltest.BenchmarkAll(t, Type, makeSqlite, conf)
    36  }