Files
convx/10to64_test.go
T
2024-10-28 21:28:58 +08:00

32 lines
471 B
Go

package convx_test
import (
"fmt"
"math"
"testing"
"code.yun.ink/pkg/convx"
)
func Test10to64(t *testing.T) {
var tests = []struct {
in int64
}{
{math.MaxInt64},
{-987654321},
// {-1234567890},
// {-987654321},
{0},
}
for _, test := range tests {
s, err := convx.Encode10To64(test.in)
fmt.Println(test.in, s, err)
n, err := convx.Decode64To10(s)
fmt.Println(n, err)
if n != test.in {
t.Errorf("10to64: %d != %d", n, test.in)
}
}
}