gokultp / go-four-in-a-row

A simple command-line implementation of the game `four in the row`
MIT License
12 stars 13 forks source link

add unit tests for game package functions #7

Open gokultp opened 6 years ago

charly3pins commented 6 years ago

Maybe would be nice to split more the functionalities in a different files, bc the game.go has a lot of responsibility now and it's hard to test all bc are too coupled.

gokultp commented 6 years ago

@charly3pins do you want to take this up ?

dskoda1 commented 6 years ago

its a pretty major refactoring to do what @charly3pins. One of the biggest difficulties i encountered doing #25 was the game draw loop was called from multiple places. Centralizing the caller of this could make future enhancements easier. @gokultp are you interested in digging into this?

gokultp commented 6 years ago

@dskoda1 will take a look into this.

yulrizka commented 6 years ago

Oh I didn't see this issue, sorry if someone already picked it up, I noticed there was panic on isWon, I created unit test while fixing it, see #27

I noticed the logic of the game is coupled with the logic of drawing, My recommendation is to split that for testability