2021-07-02 20:00:19 -07:00
|
|
|
package commands
|
|
|
|
|
|
|
|
|
|
import (
|
2021-08-17 16:47:06 -07:00
|
|
|
"testing"
|
|
|
|
|
|
2021-07-02 20:00:19 -07:00
|
|
|
"github.com/BattlesnakeOfficial/rules"
|
|
|
|
|
)
|
|
|
|
|
|
|
|
|
|
func TestGetIndividualBoardStateForSnake(t *testing.T) {
|
|
|
|
|
s1 := rules.Snake{ID: "one", Body: []rules.Point{{X: 3, Y: 3}}}
|
|
|
|
|
s2 := rules.Snake{ID: "two", Body: []rules.Point{{X: 4, Y: 3}}}
|
|
|
|
|
state := &rules.BoardState{
|
|
|
|
|
Height: 11,
|
|
|
|
|
Width: 11,
|
|
|
|
|
Snakes: []rules.Snake{s1, s2},
|
|
|
|
|
}
|
2021-08-17 16:47:06 -07:00
|
|
|
snake := Battlesnake{Name: "one", URL: "", ID: "one"}
|
|
|
|
|
requestBody := getIndividualBoardStateForSnake(state, snake, &rules.StandardRuleset{})
|
2021-07-02 20:00:19 -07:00
|
|
|
|
2021-09-07 14:58:10 -07:00
|
|
|
rules.RequireJSONMatchesFixture(t, "testdata/snake_request_body.json", string(requestBody))
|
2021-07-02 20:00:19 -07:00
|
|
|
}
|