예제 #1
0
func TestEnv(t *testing.T) {
	assert := assert.Assert(t)

	yml := loadFile("config_env.yml")
	setting, err := kasi.ParseConfig(yml)
	assert.Equal(err, nil)

	assert.NotEqual(setting.Env.Hostname, "")
	assert.NotEqual(setting.Env.GOOS, "")
}
예제 #2
0
func Test_C4Game(t *testing.T) {
	assert := assert.Assert(t)
	game := GameWrapper{NewGame()}
	g := minimax.Game(game)
	assert.NotNil(g, "not nil")

	game1 := game.Copy()
	game1.Play(1)
	assert.NotEqual(game, game1)
}
예제 #3
0
// Make sure I wrote heap game correctly before I try to win it.
func TestHeapGame(t *testing.T) {
	assert := assert.Assert(t)
	assert.Nil(nil, "good")

	f := HeapUtilityFunction

	game := NewHeapGame(1, 2, 3, 4, 5, 6, 7, 8)
	assert.Equal(f(game), 1)

	legalMoves := game.LegalMoves()
	move := legalMoves[0]
	game1 := game.Copy()
	over, _ := game1.Play(move)
	assert.False(over, "game not yet over")
	assert.NotEqual(game, game1)
	assert.Equal(f(game1), 2)

	game2 := game1.Copy()
	over, _ = game2.Play(1)
	assert.Equal(f(game2), 5)
	assert.True(over, "game should be over")
}