Skip to content

Commit

Permalink
feat(test): add move_service_test.massCreateEntities
Browse files Browse the repository at this point in the history
  • Loading branch information
gabrielg2020 committed Nov 12, 2024
1 parent 41e6996 commit a86d1db
Showing 1 changed file with 8 additions and 0 deletions.
8 changes: 8 additions & 0 deletions api/service/move_service/move_service_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -1255,6 +1255,14 @@ func assertMoveEqual(t *testing.T, expected, actual entity.MoveEntityInterface)
assert.Equal(t, expectedCaptured, actualCaptured, "Captured piece should be equal")
}

func massCreateMoveEntities(fromX int, fromY int, positions []struct{ toY, toX int }, promotion int, isCastling bool, isEnPassant bool, captured int) []entity.MoveEntityInterface {
moves := make([]entity.MoveEntityInterface, len(positions))
for i, pos := range positions {
moves[i] = newMockMoveEntity(fromX, fromY, pos.toX, pos.toY, promotion, isCastling, isEnPassant, captured)
}
return moves
}

func newMockMoveEntity(fromX, fromY, toX, toY, promotion int, isCastling, isEnPassant bool, captured int) entity.MoveEntityInterface {
mockMove := new(mocks.MockMoveEntity)

Expand Down

0 comments on commit a86d1db

Please sign in to comment.