Example #1
0
func TestMainGenerate_difficultyInt(t *testing.T) {
	status, output := runMain(t, nil, "-mode=generate", "-difficulty=3")
	if status != 0 {
		t.Errorf("main returned %d, expected %d", status, 0)
	}

	b := NewBoard()
	_, err := b.ReadFrom(output)
	if err != nil {
		t.Errorf("error reading output board: %s", err)
	}

	unknownCount := 0
	for _, t := range b.Tiles {
		if !t.isKnown() {
			unknownCount++
		}
	}
	if unknownCount != 3 {
		t.Errorf("have %d unknown tiles, expected %d", unknownCount, 3)
	}
}