aboutsummaryrefslogtreecommitdiffstats
path: root/test/integration/beam/library.erl
diff options
context:
space:
mode:
Diffstat (limited to 'test/integration/beam/library.erl')
-rw-r--r--test/integration/beam/library.erl19
1 files changed, 19 insertions, 0 deletions
diff --git a/test/integration/beam/library.erl b/test/integration/beam/library.erl
new file mode 100644
index 0000000..b9186ab
--- /dev/null
+++ b/test/integration/beam/library.erl
@@ -0,0 +1,19 @@
+-module(library).
+-export([books/0]).
+
+books() ->
+ from([book(<<"Structure and Interpretation of Computer Programs">>, <<"Harold Abelson">>),
+ book(<<"The Art of Computer Programming">>, <<"Donald Knuth">>),
+ book(<<"An Introduction to Database Systems">>, <<"C. J. Date">>),
+ book(<<"Less Than Words Can Say">>, <<"Richard Mitchell">>),
+ book(<<"The Graves of Academe">>, <<"Richard Mitchell">>),
+ book(<<"The Leaning Tower of Babel">>, <<"Richard Mitchell">>),
+ book(<<"The Gift of Fire">>, <<"Richard Mitchell">>)]).
+
+book(Title, Author) -> {<<"book">>, #{<<"title">> => Title, <<"author">> => Author}}.
+
+from(Books) ->
+ fun(Limit) ->
+ {Now, Later} = lists:split(min(Limit, length(Books)), Books),
+ {Now, case Later of [] -> done; _ -> from(Later) end}
+ end.