-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Add coverage for the
update
function
- Loading branch information
1 parent
ea41445
commit f66b6fa
Showing
7 changed files
with
100 additions
and
41 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,7 @@ | ||
module GameLogic exposing (noneUnclaimed) | ||
|
||
import Array exposing (..) | ||
import Player exposing (..) | ||
|
||
noneUnclaimed : Array Player -> Bool | ||
noneUnclaimed ary = (0 == length(filter (\x -> x == Unclaimed) ary)) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,21 @@ | ||
module Unit.GameLogicTests exposing (gameLogicTests) | ||
|
||
import Test exposing (..) | ||
import Expect | ||
import Array | ||
import GameLogic exposing (noneUnclaimed) | ||
import Model exposing (Model, initialModel) | ||
import Player exposing (Player (A, B, Unclaimed)) | ||
|
||
gameLogicTests : List Test | ||
gameLogicTests = [ describe "GameLogic.noneUnclaimed" | ||
[ test "returns True if none of the boxes are unclaimed" <| | ||
\() -> | ||
Expect.equal True | ||
<| noneUnclaimed <| Array.fromList <| [A, B, A] | ||
, test "returns False if at least one box is unclaimed" <| | ||
\() -> | ||
Expect.equal False | ||
<| noneUnclaimed <| Array.fromList <| [A, Unclaimed, A] | ||
] | ||
] |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters