23 lines
352 B
Go
23 lines
352 B
Go
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);
|
|
}
|
|
|
|
} |