Skip to content

Commit

Permalink
Replace == with =:=, due to coaxing from Kostis Sagonas
Browse files Browse the repository at this point in the history
  • Loading branch information
Andreas Pauley committed Mar 29, 2011
1 parent 9c69a9d commit faa8a31
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 7 deletions.
4 changes: 2 additions & 2 deletions sudoku.erl
Original file line number Diff line number Diff line change
Expand Up @@ -189,8 +189,8 @@ is_solved(Puzzle) ->
all(fun(Unit) -> is_unit_solved(Puzzle, Unit) end, unitlist()).
is_unit_solved(Puzzle, Unit) ->
UnitValues = flatmap(fun(S) -> values(Puzzle, S) end, Unit),
(length(UnitValues) == 9)
and (lists:usort(UnitValues) == ?digits).
(length(UnitValues) =:= 9)
and (lists:usort(UnitValues) =:= ?digits).

to_string(Puzzle) ->
{ValuesDict, _} = Puzzle,
Expand Down
10 changes: 5 additions & 5 deletions unittests.erl
Original file line number Diff line number Diff line change
Expand Up @@ -45,11 +45,11 @@ test_units() ->
[[a2,b2,c2,d2,e2,f2,g2,h2,i2]|_] = units(c2),

%% Each square should have exactly 3 units
true = all(fun(Units) -> length(Units) == 3 end,
true = all(fun(Units) -> length(Units) =:= 3 end,
[units(Square) || Square <- squares()]),

%% Each unit should contain exactly nine squares
TruthValues = [all(fun(Unit) -> length(Unit) == 9 end,
TruthValues = [all(fun(Unit) -> length(Unit) =:= 9 end,
units(Square)) || Square <- squares()],

%% Each square should be part of all its units
Expand All @@ -67,7 +67,7 @@ test_peers() ->
Peers = sort(peers(c2)),

%% Each square should have exactly 20 squares as its peers
true = all(fun(Units) -> length(Units) == 20 end,
true = all(fun(Units) -> length(Units) =:= 20 end,
[peers(Square) || Square <- squares()]),
ok.

Expand All @@ -80,7 +80,7 @@ test_empty_puzzle() ->
%% The values of all keys should start with all possible values.
Squares = squares(),
Digits = "123456789",
true = all(fun(Values) -> Values == Digits end,
true = all(fun(Values) -> Values =:= Digits end,
[values(Puzzle, Square) || Square <- Squares]),
ok.

Expand Down Expand Up @@ -225,7 +225,7 @@ is_sudoku_puzzle(Puzzle) ->
is_sudoku_dict(ValuesDict).

is_sudoku_dict(ValuesDict) ->
lists:sort(dict:fetch_keys(ValuesDict)) == squares().
lists:sort(dict:fetch_keys(ValuesDict)) =:= squares().

solved_puzzle() ->
GridString = "41736982563215894795872431682543
Expand Down

0 comments on commit faa8a31

Please sign in to comment.