2013-08-26 13:41:58 +08:00
|
|
|
package client
|
|
|
|
|
|
|
|
import (
|
|
|
|
"testing"
|
|
|
|
)
|
|
|
|
|
|
|
|
func TestAutoInc(t *testing.T) {
|
|
|
|
ai := NewAutoIncId()
|
|
|
|
|
2014-05-21 04:16:38 +08:00
|
|
|
previous := ai.Id("testfuncname", "fakepayload")
|
2013-08-26 13:41:58 +08:00
|
|
|
for i := 0; i < 10; i++ {
|
2014-05-21 04:16:38 +08:00
|
|
|
id := ai.Id("testfuncname", "fakepayload2")
|
2013-08-26 13:41:58 +08:00
|
|
|
if id == previous {
|
|
|
|
t.Errorf("Id not unique, previous and current %s", id)
|
|
|
|
}
|
|
|
|
previous = id
|
|
|
|
}
|
|
|
|
}
|