-
Notifications
You must be signed in to change notification settings - Fork 0
/
Strategies.Test.fs
50 lines (42 loc) · 1.2 KB
/
Strategies.Test.fs
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
module ShutTheBox.StrategiesTests
open Xunit
open FsUnit
open ShutTheBox.Strategies
let lowestFirstTestData: obj[][] = [|
[|[1..9]; 2; Some [2]|]
[|[1..9]; 3; Some [1; 2]|]
[|[1..9]; 4; Some [1; 3]|]
[|[1..9]; 9; Some [1; 8]|]
[|[1..9]; 10; Some [1; 9]|]
[|[1..9]; 12; Some [1; 5; 6]|]
[|[7; 8; 9]; 6; None|]
[|[9]; 9; Some [9]|]
[|[1; 2; 3]; 6; Some [1; 2; 3]|]
|]
[<Theory>]
[<MemberData("lowestFirstTestData")>]
let lowestFirstTest (box, target, expected) =
let result = lowestFirst target box
result |> should equal expected
let highestFirstTestData: obj[][] = [|
[|[1..9]; 2; Some [2]|]
[|[1..9]; 3; Some [3]|]
[|[1..9]; 9; Some [9]|]
[|[1..9]; 10; Some [1; 9]|]
[|[1..9]; 12; Some [3; 9]|]
[|[7; 8; 9]; 6; None|]
[|[9]; 9; Some [9]|]
|]
[<Theory>]
[<MemberData("highestFirstTestData")>]
let highestFirstTest (box, target, expected) =
let result = highestFirst target box
result |> should equal expected
let avoidAllTestData: obj[][] = [|
[|[1..9]; 7; Some [1, 6]|]
|]
[<Theory>]
[<MemberData("avoidAllTestData")>]
let avoidAllTest (box, target, expected) =
let result = avoidAll target box
result |> should equal expected