github.com/cayleygraph/cayley@v0.7.7/graph/nosql/value_test.go (about)

     1  package nosql
     2  
     3  import (
     4  	"math"
     5  	"sort"
     6  	"testing"
     7  )
     8  
     9  func TestIntStr(t *testing.T) {
    10  	var testS []string
    11  	testI := []int64{
    12  		120000, -4, 88, 0, -7000000, 88,
    13  		math.MaxInt64 - 1, math.MaxInt64,
    14  		math.MinInt64, math.MinInt64 + 1,
    15  	}
    16  	for _, v := range testI {
    17  		testS = append(testS, itos(v))
    18  	}
    19  	sort.Strings(testS)
    20  	sort.Slice(testI, func(i, j int) bool { return testI[i] < testI[j] })
    21  	for k, v := range testS {
    22  		r := stoi(v)
    23  		if r != testI[k] {
    24  			t.Errorf("Sorting of stringed int64s wrong: %v %v %v", k, r, testI[k])
    25  		}
    26  	}
    27  }