|
| 1 | +defmodule KillerSudokuHelperTest do |
| 2 | + use ExUnit.Case |
| 3 | + |
| 4 | + describe "Trivial 1-digit cages" do |
| 5 | + # @tag :pending |
| 6 | + test "1" do |
| 7 | + cage = %{exclude: [], size: 1, sum: 1} |
| 8 | + assert KillerSudokuHelper.combinations(cage) == [[1]] |
| 9 | + end |
| 10 | + |
| 11 | + @tag :pending |
| 12 | + test "2" do |
| 13 | + cage = %{exclude: [], size: 1, sum: 2} |
| 14 | + assert KillerSudokuHelper.combinations(cage) == [[2]] |
| 15 | + end |
| 16 | + |
| 17 | + @tag :pending |
| 18 | + test "3" do |
| 19 | + cage = %{exclude: [], size: 1, sum: 3} |
| 20 | + assert KillerSudokuHelper.combinations(cage) == [[3]] |
| 21 | + end |
| 22 | + |
| 23 | + @tag :pending |
| 24 | + test "4" do |
| 25 | + cage = %{exclude: [], size: 1, sum: 4} |
| 26 | + assert KillerSudokuHelper.combinations(cage) == [[4]] |
| 27 | + end |
| 28 | + |
| 29 | + @tag :pending |
| 30 | + test "5" do |
| 31 | + cage = %{exclude: [], size: 1, sum: 5} |
| 32 | + assert KillerSudokuHelper.combinations(cage) == [[5]] |
| 33 | + end |
| 34 | + |
| 35 | + @tag :pending |
| 36 | + test "6" do |
| 37 | + cage = %{exclude: [], size: 1, sum: 6} |
| 38 | + assert KillerSudokuHelper.combinations(cage) == [[6]] |
| 39 | + end |
| 40 | + |
| 41 | + @tag :pending |
| 42 | + test "7" do |
| 43 | + cage = %{exclude: [], size: 1, sum: 7} |
| 44 | + assert KillerSudokuHelper.combinations(cage) == [[7]] |
| 45 | + end |
| 46 | + |
| 47 | + @tag :pending |
| 48 | + test "8" do |
| 49 | + cage = %{exclude: [], size: 1, sum: 8} |
| 50 | + assert KillerSudokuHelper.combinations(cage) == [[8]] |
| 51 | + end |
| 52 | + |
| 53 | + @tag :pending |
| 54 | + test "9" do |
| 55 | + cage = %{exclude: [], size: 1, sum: 9} |
| 56 | + assert KillerSudokuHelper.combinations(cage) == [[9]] |
| 57 | + end |
| 58 | + end |
| 59 | + |
| 60 | + @tag :pending |
| 61 | + test "Cage with sum 45 contains all digits 1:9" do |
| 62 | + cage = %{exclude: [], size: 9, sum: 45} |
| 63 | + assert KillerSudokuHelper.combinations(cage) == [[1, 2, 3, 4, 5, 6, 7, 8, 9]] |
| 64 | + end |
| 65 | + |
| 66 | + @tag :pending |
| 67 | + test "Cage with only 1 possible combination" do |
| 68 | + cage = %{exclude: [], size: 3, sum: 7} |
| 69 | + assert KillerSudokuHelper.combinations(cage) == [[1, 2, 4]] |
| 70 | + end |
| 71 | + |
| 72 | + @tag :pending |
| 73 | + test "Cage with several combinations" do |
| 74 | + cage = %{exclude: [], size: 2, sum: 10} |
| 75 | + assert KillerSudokuHelper.combinations(cage) == [[1, 9], [2, 8], [3, 7], [4, 6]] |
| 76 | + end |
| 77 | + |
| 78 | + @tag :pending |
| 79 | + test "Cage with several combinations that is restricted" do |
| 80 | + cage = %{exclude: [1, 4], size: 2, sum: 10} |
| 81 | + assert KillerSudokuHelper.combinations(cage) == [[2, 8], [3, 7]] |
| 82 | + end |
| 83 | +end |
0 commit comments