Permalink
Browse files

Get word list

  • Loading branch information...
grahamrhay committed Dec 30, 2018
1 parent f525821 commit 59dd5cbe39fa19be42ea5d8995f6cf7c4e06e501
Showing with 274,945 additions and 10 deletions.
  1. +4 −10 src/word_chains.erl
  2. +15 −0 test/prop_word_chains.erl
  3. +274,926 −0 words.txt
@@ -1,13 +1,7 @@
-module(word_chains).

%% API exports
-export([]).
-export([word_list/0]).

%%====================================================================
%% API functions
%%====================================================================


%%====================================================================
%% Internal functions
%%====================================================================
word_list() ->
{ok, Data} = file:read_file("words.txt"),
binary:split(Data, [<<"\n">>], [global]).
@@ -1,9 +1,24 @@
-module(prop_word_chains).

-include_lib("proper/include/proper.hrl").
-include_lib("eunit/include/eunit.hrl").

prop_word_chains() ->
?FORALL(_, term(),
begin
true
end).

word_list_test() ->
WordList = word_chains:word_list(),
?assertEqual(length(WordList), 274926).

word_list_first_word_test() ->
WordList = word_chains:word_list(),
FirstWord = lists:nth(1, WordList),
?assertEqual(FirstWord, <<"aa">>).

word_list_last_word_test() ->
WordList = word_chains:word_list(),
LastWord = lists:last(WordList),
?assertEqual(LastWord, <<"zzzs">>).
Oops, something went wrong.

0 comments on commit 59dd5cb

Please sign in to comment.