|
| 1 | +minesweeper.annotate.tests.ex1 = |
| 2 | + expected = [] |
| 3 | + input = [] |
| 4 | + expected === minesweeper.annotate input |
| 5 | + |> expect |
| 6 | + |> Test.label "no rows" |
| 7 | + |
| 8 | +minesweeper.annotate.tests.ex2 = |
| 9 | + expected = [""] |
| 10 | + input = [""] |
| 11 | + expected === minesweeper.annotate input |
| 12 | + |> expect |
| 13 | + |> Test.label "no columns" |
| 14 | + |
| 15 | +minesweeper.annotate.tests.ex3 = |
| 16 | + expected = [" ", " ", " "] |
| 17 | + input = [" ", " ", " "] |
| 18 | + expected === minesweeper.annotate input |
| 19 | + |> expect |
| 20 | + |> Test.label "no mines" |
| 21 | + |
| 22 | +minesweeper.annotate.tests.ex4 = |
| 23 | + expected = ["***", "***", "***"] |
| 24 | + input = ["***", "***", "***"] |
| 25 | + expected === minesweeper.annotate input |
| 26 | + |> expect |
| 27 | + |> Test.label "minefield with only mines" |
| 28 | + |
| 29 | +minesweeper.annotate.tests.ex5 = |
| 30 | + expected = ["111", "1*1", "111"] |
| 31 | + input = [" ", " * ", " "] |
| 32 | + expected === minesweeper.annotate input |
| 33 | + |> expect |
| 34 | + |> Test.label "mine surrounded by spaces" |
| 35 | + |
| 36 | +minesweeper.annotate.tests.ex6 = |
| 37 | + expected = ["***", "*8*", "***"] |
| 38 | + input = ["***", "* *", "***"] |
| 39 | + expected === minesweeper.annotate input |
| 40 | + |> expect |
| 41 | + |> Test.label "space surrounded by mines" |
| 42 | + |
| 43 | +minesweeper.annotate.tests.ex7 = |
| 44 | + expected = ["1*2*1"] |
| 45 | + input = [" * * "] |
| 46 | + expected === minesweeper.annotate input |
| 47 | + |> expect |
| 48 | + |> Test.label "horizontal line" |
| 49 | + |
| 50 | +minesweeper.annotate.tests.ex8 = |
| 51 | + expected = ["*1 1*"] |
| 52 | + input = ["* *"] |
| 53 | + expected === minesweeper.annotate input |
| 54 | + |> expect |
| 55 | + |> Test.label "horizontal line, mines at edges" |
| 56 | + |
| 57 | +minesweeper.annotate.tests.ex9 = |
| 58 | + expected = ["1", "*", "2", "*", "1"] |
| 59 | + input = [" ", "*", " ", "*", " "] |
| 60 | + expected === minesweeper.annotate input |
| 61 | + |> expect |
| 62 | + |> Test.label "vertical line" |
| 63 | + |
| 64 | +minesweeper.annotate.tests.ex10 = |
| 65 | + expected = ["*", "1", " ", "1", "*"] |
| 66 | + input = ["*", " ", " ", " ", "*"] |
| 67 | + expected === minesweeper.annotate input |
| 68 | + |> expect |
| 69 | + |> Test.label "vertical line, mines at edges" |
| 70 | + |
| 71 | +minesweeper.annotate.tests.ex11 = |
| 72 | + expected = [" 2*2 ", "25*52", "*****", "25*52", " 2*2 "] |
| 73 | + input = [" * ", " * ", "*****", " * ", " * "] |
| 74 | + expected === minesweeper.annotate input |
| 75 | + |> expect |
| 76 | + |> Test.label "cross" |
| 77 | + |
| 78 | +minesweeper.annotate.tests.ex12 = |
| 79 | + expected = ["1*22*1", "12*322", " 123*2", "112*4*", "1*22*2", "111111"] |
| 80 | + input = [" * * ", " * ", " * ", " * *", " * * ", " "] |
| 81 | + expected === minesweeper.annotate input |
| 82 | + |> expect |
| 83 | + |> Test.label "large minefield" |
| 84 | + |
| 85 | +test> minesweeper.tests = runAll [ |
| 86 | + minesweeper.annotate.tests.ex1, |
| 87 | + minesweeper.annotate.tests.ex2, |
| 88 | + minesweeper.annotate.tests.ex3, |
| 89 | + minesweeper.annotate.tests.ex4, |
| 90 | + minesweeper.annotate.tests.ex5, |
| 91 | + minesweeper.annotate.tests.ex6, |
| 92 | + minesweeper.annotate.tests.ex7, |
| 93 | + minesweeper.annotate.tests.ex8, |
| 94 | + minesweeper.annotate.tests.ex9, |
| 95 | + minesweeper.annotate.tests.ex10, |
| 96 | + minesweeper.annotate.tests.ex11, |
| 97 | + minesweeper.annotate.tests.ex12 |
| 98 | +] |
0 commit comments