Example #1
0
func TestBinaryTournament(t *testing.T) {
	var stats evo.Stats
	pop := dummies()
	for i := 0; i < 1e6; i++ {
		winner := sel.BinaryTournament(pop...).(dummy)
		stats = stats.Put(float64(winner))
	}
	if stats.Mean() < 5.5 || 6.5 < stats.Mean() {
		t.Fail()
	}
}
Example #2
0
func TestLognormal(t *testing.T) {
	var s evo.Stats
	for i := 0; i < 65536; i++ {
		x := math.Log(real.Lognormal(1e-3))
		s = s.Put(x)
	}
	mean := s.Mean()
	if mean < -1e-3 || 1e-3 < mean || math.IsNaN(mean) {
		t.Fail()
	}
}