schastsp/internal/timeid/timeid_test.go

23 lines
352 B
Go
Raw Permalink Normal View History

2018-04-25 06:17:20 +00:00
package timeid
import (
"time"
"testing"
)
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);
}
}