Example #1
0
func TestMakeTreeGrowBalanced(t *testing.T) {
	// TODO how do I check if the trees are really what I am expecting?
	numTerms, numFuncs := 0, 0
	for i := 0; i < 10000; i++ {
		t := genBalTree(10)
		nods, _, _ := t.Enumerate()
		for _, v := range nods {
			if v.value.Arity() > 0 {
				numFuncs++
			} else {
				numTerms++
			}
		}
	}
	t.Error("Termals vs functionals", float64(numTerms)/float64(numFuncs))
}