schastsp/internal/timeid/timeid_test.go

23 lines
347 B
Go

package timeid
import (
"testing"
"time"
)
func TestGuessing(t *testing.T) {
var windowSize float64 = .5
id, parity := Generate(windowSize)
time.Sleep(time.Duration(windowSize) * time.Second)
var guessedId = Guess(windowSize, parity)
if id != guessedId {
t.Errorf("Wrong guessed id, expected '%d' ; got '%d'", id, guessedId)
}
}