1
0
mirror of https://github.com/charlienet/go-mixed.git synced 2025-07-18 00:22:41 +08:00
Files
go-mixed/idGenerator/formater_test.go
2023-10-26 14:42:23 +08:00

35 lines
773 B
Go

package idgenerator
import (
"testing"
)
func TestBinary(t *testing.T) {
f, _ := newBinaryFormatter(DefaultStartTimeStamp, 16, 12)
t.Log(f.maxinalMachineCode, f.maximalSequence)
}
func TestDecimal(t *testing.T) {
f, _ := newDecimalFormater(YYYYMMDDHHmmss, 4, 1)
t.Log(f.maxinalMachineCode, f.maxinalMachineCode)
t.Log(f.Format(22333, 9, false))
}
func TestDecimalMonth111(t *testing.T) {
f, _ := newDecimalFormater(YYYYMMDD, 4, 1)
t.Log(f.maxinalMachineCode, f.maxinalMachineCode)
t.Log(f.Format(233, 9, false))
}
func TestBinaryTimestamp(t *testing.T) {
f, _ := newBinaryFormatter(DefaultStartTimeStamp, 10, 4)
for i := 0; i < 100; i++ {
if i%7 == 0 {
t.Log(f.Format(int64(i), 0xF, true))
} else {
t.Log(f.Format(int64(i), 0xF, false))
}
}
}