Пример #1
0
func VerifyDeserializedBoard(b *Board, assert *assert.Assertions) {
	assert.Equal(4, len(b.Segments))
	assert.Equal(4*7, len(b.Points))

	pos := Position{X: 6, Y: 6}
	assert.Equal(pos, b.Points[pos].Position)
	assert.Equal(false, b.Points[pos].IsDead)
	assert.Equal(0, b.Points[pos].Tower.Player)
	assert.Equal(1, b.Points[pos].Tower.Height)
	assert.Equal(false, b.Points[pos].Tower.IsGrowingPoint)

	pos = Position{X: 7, Y: 7}
	assert.Equal(pos, b.Points[pos].Position)
	assert.Equal(false, b.Points[pos].IsDead)
	assert.Equal(0, b.Points[pos].Tower.Player)
	assert.Equal(2, b.Points[pos].Tower.Height)
	assert.Equal(true, b.Points[pos].Tower.IsGrowingPoint)

	pos = Position{X: 10, Y: 5}
	assert.Equal(pos, b.Points[pos].Position)
	assert.Equal(false, b.Points[pos].IsDead)
	assert.Equal(1, b.Points[pos].Tower.Player)
	assert.Equal(1, b.Points[pos].Tower.Height)
	assert.Equal(false, b.Points[pos].Tower.IsGrowingPoint)

	pos = Position{X: 11, Y: 6}
	assert.Equal(pos, b.Points[pos].Position)
	assert.Equal(false, b.Points[pos].IsDead)
	assert.Equal(1, b.Points[pos].Tower.Player)
	assert.Equal(2, b.Points[pos].Tower.Height)
	assert.Equal(true, b.Points[pos].Tower.IsGrowingPoint)

	pos = Position{X: 8, Y: 5}
	assert.Equal(pos, b.Points[pos].Position)
	assert.Equal(true, b.Points[pos].IsDead)

	pos = Position{X: 10, Y: 8}
	assert.Equal(pos, b.Points[pos].Position)
	assert.Equal(true, b.Points[pos].IsDead)

	assert.NotEqual("", b.DebugString())
}