You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
 
 
 
 
 

25 lines
555 B

package sequence
import (
"encoding/hex"
"github.com/chrislusf/seaweedfs/weed/storage/types"
"github.com/stretchr/testify/assert"
"testing"
)
func TestSequencer(t *testing.T) {
seq, err := NewSnowflakeSequencer("for_test", 1)
assert.Equal(t, nil, err)
last := uint64(0)
bytes := make([]byte, types.NeedleIdSize)
for i := 0; i < 100; i++ {
next := seq.NextFileId(1)
types.NeedleIdToBytes(bytes, types.NeedleId(next))
println(hex.EncodeToString(bytes))
if last == next {
t.Errorf("last %d next %d", last, next)
}
last = next
}
}