https://github.com/google/cayley
Raw File
Tip revision: f29f0029aff3dc0d57d8f2867077895d3c55dc57 authored by Iddan Aaronsohn on 27 December 2019, 17:59:44 UTC
Use namespace everywhere a literal value is used
Tip revision: f29f002
value_test.go
package nosql

import (
	"math"
	"sort"
	"testing"
)

func TestIntStr(t *testing.T) {
	var testS []string
	testI := []int64{
		120000, -4, 88, 0, -7000000, 88,
		math.MaxInt64 - 1, math.MaxInt64,
		math.MinInt64, math.MinInt64 + 1,
	}
	for _, v := range testI {
		testS = append(testS, itos(v))
	}
	sort.Strings(testS)
	sort.Slice(testI, func(i, j int) bool { return testI[i] < testI[j] })
	for k, v := range testS {
		r := stoi(v)
		if r != testI[k] {
			t.Errorf("Sorting of stringed int64s wrong: %v %v %v", k, r, testI[k])
		}
	}
}
back to top