aboutsummaryrefslogtreecommitdiff
path: root/gen
diff options
context:
space:
mode:
authorLouis Pilfold <louis@lpil.uk>2019-06-25 22:48:07 +0100
committerLouis Pilfold <louis@lpil.uk>2019-06-25 22:48:07 +0100
commit2c2541750ca4b7b604070c75c18d84be833c97d5 (patch)
treef5e63d941a1c7e2c2d4dff1d81c43fa2766308ae /gen
parent96c20b8ebf8420fbba75c97fa08eaeb34e8dc394 (diff)
downloadgleam_stdlib-2c2541750ca4b7b604070c75c18d84be833c97d5.tar.gz
gleam_stdlib-2c2541750ca4b7b604070c75c18d84be833c97d5.zip
stdlib namespace std -> gleam
Diffstat (limited to 'gen')
-rw-r--r--gen/src/gleam@any.erl (renamed from gen/src/std@any.erl)8
-rw-r--r--gen/src/gleam@atom.erl (renamed from gen/src/std@atom.erl)2
-rw-r--r--gen/src/gleam@bool.erl (renamed from gen/src/std@bool.erl)2
-rw-r--r--gen/src/gleam@expect.erl (renamed from gen/src/std@expect.erl)2
-rw-r--r--gen/src/gleam@float.erl (renamed from gen/src/std@float.erl)4
-rw-r--r--gen/src/gleam@http.erl (renamed from gen/src/std@http.erl)2
-rw-r--r--gen/src/gleam@int.erl (renamed from gen/src/std@int.erl)2
-rw-r--r--gen/src/gleam@iodata.erl (renamed from gen/src/std@iodata.erl)2
-rw-r--r--gen/src/gleam@list.erl (renamed from gen/src/std@list.erl)4
-rw-r--r--gen/src/gleam@map_dict.erl (renamed from gen/src/std@map_dict.erl)4
-rw-r--r--gen/src/gleam@order.erl (renamed from gen/src/std@order.erl)2
-rw-r--r--gen/src/gleam@result.erl (renamed from gen/src/std@result.erl)2
-rw-r--r--gen/src/gleam@string.erl28
-rw-r--r--gen/src/gleam@tuple.erl28
-rw-r--r--gen/src/std@string.erl28
-rw-r--r--gen/src/std@tuple.erl28
-rw-r--r--gen/test/gleam@any_test.erl118
-rw-r--r--gen/test/gleam@atom_test.erl24
-rw-r--r--gen/test/gleam@bool_test.erl30
-rw-r--r--gen/test/gleam@float_test.erl42
-rw-r--r--gen/test/gleam@http_test.erl (renamed from gen/test/std@http_test.erl)2
-rw-r--r--gen/test/gleam@int_test.erl29
-rw-r--r--gen/test/gleam@iodata_test.erl58
-rw-r--r--gen/test/gleam@list_test.erl208
-rw-r--r--gen/test/gleam@map_dict_test.erl151
-rw-r--r--gen/test/gleam@order_test.erl47
-rw-r--r--gen/test/gleam@result_test.erl47
-rw-r--r--gen/test/gleam@string_test.erl34
-rw-r--r--gen/test/gleam@tuple_test.erl23
-rw-r--r--gen/test/std@any_test.erl110
-rw-r--r--gen/test/std@atom_test.erl24
-rw-r--r--gen/test/std@bool_test.erl30
-rw-r--r--gen/test/std@float_test.erl42
-rw-r--r--gen/test/std@int_test.erl29
-rw-r--r--gen/test/std@iodata_test.erl57
-rw-r--r--gen/test/std@list_test.erl196
-rw-r--r--gen/test/std@map_dict_test.erl133
-rw-r--r--gen/test/std@order_test.erl47
-rw-r--r--gen/test/std@result_test.erl47
-rw-r--r--gen/test/std@string_test.erl33
-rw-r--r--gen/test/std@tuple_test.erl23
41 files changed, 887 insertions, 845 deletions
diff --git a/gen/src/std@any.erl b/gen/src/gleam@any.erl
index 5a1a844..a81a836 100644
--- a/gen/src/std@any.erl
+++ b/gen/src/gleam@any.erl
@@ -1,4 +1,4 @@
--module(std@any).
+-module(gleam@any).
-compile(no_auto_import).
-export([from/1, unsafe_coerce/1, string/1, int/1, float/1, atom/1, bool/1, thunk/1, list/2, tuple/1, field/2]).
@@ -31,8 +31,10 @@ list_any(A) ->
gleam__stdlib:decode_list(A).
list(Any, Decode) ->
- std@result:then(list_any(Any),
- fun(Capture1) -> std@list:traverse(Capture1, Decode) end).
+ gleam@result:then(list_any(Any),
+ fun(Capture1) ->
+ gleam@list:traverse(Capture1, Decode)
+ end).
tuple(A) ->
gleam__stdlib:decode_tuple(A).
diff --git a/gen/src/std@atom.erl b/gen/src/gleam@atom.erl
index a964101..83392aa 100644
--- a/gen/src/std@atom.erl
+++ b/gen/src/gleam@atom.erl
@@ -1,4 +1,4 @@
--module(std@atom).
+-module(gleam@atom).
-compile(no_auto_import).
-export([from_string/1, create_from_string/1, to_string/1]).
diff --git a/gen/src/std@bool.erl b/gen/src/gleam@bool.erl
index c77a2d8..6714261 100644
--- a/gen/src/std@bool.erl
+++ b/gen/src/gleam@bool.erl
@@ -1,4 +1,4 @@
--module(std@bool).
+-module(gleam@bool).
-compile(no_auto_import).
-export([negate/1, compare/2, max/2, min/2, to_int/1]).
diff --git a/gen/src/std@expect.erl b/gen/src/gleam@expect.erl
index 30b3156..72a4389 100644
--- a/gen/src/std@expect.erl
+++ b/gen/src/gleam@expect.erl
@@ -1,4 +1,4 @@
--module(std@expect).
+-module(gleam@expect).
-compile(no_auto_import).
-export([equal/2, not_equal/2, true/1, false/1, is_ok/1, is_error/1, fail/0]).
diff --git a/gen/src/std@float.erl b/gen/src/gleam@float.erl
index c627707..0d8ec08 100644
--- a/gen/src/std@float.erl
+++ b/gen/src/gleam@float.erl
@@ -1,4 +1,4 @@
--module(std@float).
+-module(gleam@float).
-compile(no_auto_import).
-export([parse/1, to_string/1, ceiling/1, floor/1, round/1, truncate/1]).
@@ -7,7 +7,7 @@ parse(A) ->
gleam__stdlib:parse_float(A).
to_string(F) ->
- std@iodata:to_string(std@iodata:from_float(F)).
+ gleam@iodata:to_string(gleam@iodata:from_float(F)).
ceiling(A) ->
math:ceil(A).
diff --git a/gen/src/std@http.erl b/gen/src/gleam@http.erl
index c141e95..8863ae6 100644
--- a/gen/src/std@http.erl
+++ b/gen/src/gleam@http.erl
@@ -1,4 +1,4 @@
--module(std@http).
+-module(gleam@http).
-compile(no_auto_import).
-export([]).
diff --git a/gen/src/std@int.erl b/gen/src/gleam@int.erl
index 9942040..49641a6 100644
--- a/gen/src/std@int.erl
+++ b/gen/src/gleam@int.erl
@@ -1,4 +1,4 @@
--module(std@int).
+-module(gleam@int).
-compile(no_auto_import).
-export([parse/1, to_string/1, to_base_string/2, compare/2]).
diff --git a/gen/src/std@iodata.erl b/gen/src/gleam@iodata.erl
index e115bbc..cf7942e 100644
--- a/gen/src/std@iodata.erl
+++ b/gen/src/gleam@iodata.erl
@@ -1,4 +1,4 @@
--module(std@iodata).
+-module(gleam@iodata).
-compile(no_auto_import).
-export([prepend/2, append/2, prepend_iodata/2, append_iodata/2, from_strings/1, concat/1, new/1, to_string/1, byte_size/1, from_float/1, lowercase/1, uppercase/1, reverse/1, split/2, replace/3, is_equal/2, is_empty/1]).
diff --git a/gen/src/std@list.erl b/gen/src/gleam@list.erl
index db2efae..548e983 100644
--- a/gen/src/std@list.erl
+++ b/gen/src/gleam@list.erl
@@ -1,4 +1,4 @@
--module(std@list).
+-module(gleam@list).
-compile(no_auto_import).
-export([length/1, reverse/1, is_empty/1, contains/2, head/1, tail/1, filter/2, map/2, index_map/2, traverse/2, drop/2, take/2, new/0, append/2, flatten/1, fold/3, fold_right/3, find/2, all/2, any/2, zip/2, strict_zip/2, intersperse/2, at/2, unique/1, sort/1, range/2, repeat/2, split/2, split_while/2]).
@@ -309,7 +309,7 @@ sort(List) ->
end.
range(Start, Stop) ->
- case std@int:compare(Start, Stop) of
+ case gleam@int:compare(Start, Stop) of
eq ->
[];
diff --git a/gen/src/std@map_dict.erl b/gen/src/gleam@map_dict.erl
index b736096..77eaf79 100644
--- a/gen/src/std@map_dict.erl
+++ b/gen/src/gleam@map_dict.erl
@@ -1,4 +1,4 @@
--module(std@map_dict).
+-module(gleam@map_dict).
-compile(no_auto_import).
-export([size/1, to_list/1, from_list/1, has_key/2, new/0, fetch/2, put/3, map_values/2, keys/1, values/1, filter/2, take/2, merge/2, delete/2, drop/2, update/3, fold/3]).
@@ -64,7 +64,7 @@ delete(Map, Key) ->
erl_delete(Key, Map).
drop(Map, Keys) ->
- std@list:fold(Keys, Map, fun(Key, Acc) -> delete(Acc, Key) end).
+ gleam@list:fold(Keys, Map, fun(Key, Acc) -> delete(Acc, Key) end).
update(Dict, Key, F) ->
case fetch(Dict, Key) of
diff --git a/gen/src/std@order.erl b/gen/src/gleam@order.erl
index 3a816d5..9e259ed 100644
--- a/gen/src/std@order.erl
+++ b/gen/src/gleam@order.erl
@@ -1,4 +1,4 @@
--module(std@order).
+-module(gleam@order).
-compile(no_auto_import).
-export([reverse/1, to_int/1, compare/2, max/2, min/2]).
diff --git a/gen/src/std@result.erl b/gen/src/gleam@result.erl
index eccddfd..77c5a57 100644
--- a/gen/src/std@result.erl
+++ b/gen/src/gleam@result.erl
@@ -1,4 +1,4 @@
--module(std@result).
+-module(gleam@result).
-compile(no_auto_import).
-export([is_ok/1, is_error/1, map/2, map_error/2, flatten/1, then/2, unwrap/2]).
diff --git a/gen/src/gleam@string.erl b/gen/src/gleam@string.erl
new file mode 100644
index 0000000..144d866
--- /dev/null
+++ b/gen/src/gleam@string.erl
@@ -0,0 +1,28 @@
+-module(gleam@string).
+-compile(no_auto_import).
+
+-export([length/1, lowercase/1, uppercase/1, reverse/1, split/2, replace/3, append/2]).
+
+length(A) ->
+ string:length(A).
+
+lowercase(A) ->
+ string:lowercase(A).
+
+uppercase(A) ->
+ string:uppercase(A).
+
+reverse(String) ->
+ gleam@iodata:to_string(gleam@iodata:reverse(gleam@iodata:new(String))).
+
+split(String, On) ->
+ gleam@list:map(gleam@iodata:split(gleam@iodata:new(String), On),
+ fun gleam@iodata:to_string/1).
+
+replace(String, Pattern, With) ->
+ gleam@iodata:to_string(gleam@iodata:replace(gleam@iodata:new(String),
+ Pattern,
+ With)).
+
+append(S1, S2) ->
+ gleam@iodata:to_string(gleam@iodata:append(gleam@iodata:new(S1), S2)).
diff --git a/gen/src/gleam@tuple.erl b/gen/src/gleam@tuple.erl
new file mode 100644
index 0000000..1e236bf
--- /dev/null
+++ b/gen/src/gleam@tuple.erl
@@ -0,0 +1,28 @@
+-module(gleam@tuple).
+-compile(no_auto_import).
+
+-export([new/2, first/1, second/1, swap/1, fetch/2]).
+
+new(A, B) ->
+ {A, B}.
+
+first(Tup) ->
+ {A, _} = Tup,
+ A.
+
+second(Tup) ->
+ {_, A} = Tup,
+ A.
+
+swap(Tup) ->
+ {A, B} = Tup,
+ {B, A}.
+
+fetch(Haystack, Needle) ->
+ gleam@list:find(Haystack, fun(Tuple) -> case first(Tuple) =:= Needle of
+ true ->
+ {ok, second(Tuple)};
+
+ false ->
+ {error, []}
+ end end).
diff --git a/gen/src/std@string.erl b/gen/src/std@string.erl
deleted file mode 100644
index a86cfac..0000000
--- a/gen/src/std@string.erl
+++ /dev/null
@@ -1,28 +0,0 @@
--module(std@string).
--compile(no_auto_import).
-
--export([length/1, lowercase/1, uppercase/1, reverse/1, split/2, replace/3, append/2]).
-
-length(A) ->
- string:length(A).
-
-lowercase(A) ->
- string:lowercase(A).
-
-uppercase(A) ->
- string:uppercase(A).
-
-reverse(String) ->
- std@iodata:to_string(std@iodata:reverse(std@iodata:new(String))).
-
-split(String, On) ->
- std@list:map(std@iodata:split(std@iodata:new(String), On),
- fun std@iodata:to_string/1).
-
-replace(String, Pattern, With) ->
- std@iodata:to_string(std@iodata:replace(std@iodata:new(String),
- Pattern,
- With)).
-
-append(S1, S2) ->
- std@iodata:to_string(std@iodata:append(std@iodata:new(S1), S2)).
diff --git a/gen/src/std@tuple.erl b/gen/src/std@tuple.erl
deleted file mode 100644
index 0c9e89d..0000000
--- a/gen/src/std@tuple.erl
+++ /dev/null
@@ -1,28 +0,0 @@
--module(std@tuple).
--compile(no_auto_import).
-
--export([new/2, first/1, second/1, swap/1, fetch/2]).
-
-new(A, B) ->
- {A, B}.
-
-first(Tup) ->
- {A, _} = Tup,
- A.
-
-second(Tup) ->
- {_, A} = Tup,
- A.
-
-swap(Tup) ->
- {A, B} = Tup,
- {B, A}.
-
-fetch(Haystack, Needle) ->
- std@list:find(Haystack, fun(Tuple) -> case first(Tuple) =:= Needle of
- true ->
- {ok, second(Tuple)};
-
- false ->
- {error, []}
- end end).
diff --git a/gen/test/gleam@any_test.erl b/gen/test/gleam@any_test.erl
new file mode 100644
index 0000000..db6973f
--- /dev/null
+++ b/gen/test/gleam@any_test.erl
@@ -0,0 +1,118 @@
+-module(gleam@any_test).
+-compile(no_auto_import).
+
+-export([string_test/0, int_test/0, float_test/0, thunk_test/0, bool_test/0, atom_test/0, list_test/0, tuple_test/0, field_test/0]).
+
+string_test() ->
+ gleam@expect:equal(gleam@any:string(gleam@any:from(<<"">>)), {ok, <<"">>}),
+ gleam@expect:equal(gleam@any:string(gleam@any:from(<<"Hello">>)),
+ {ok, <<"Hello">>}),
+ gleam@expect:equal(gleam@any:string(gleam@any:from(1)),
+ {error, <<"Expected a String, got `1`">>}),
+ gleam@expect:equal(gleam@any:string(gleam@any:from([])),
+ {error, <<"Expected a String, got `[]`">>}).
+
+int_test() ->
+ gleam@expect:equal(gleam@any:int(gleam@any:from(1)), {ok, 1}),
+ gleam@expect:equal(gleam@any:int(gleam@any:from(2)), {ok, 2}),
+ gleam@expect:equal(gleam@any:int(gleam@any:from(1.0)),
+ {error, <<"Expected an Int, got `1.0`">>}),
+ gleam@expect:equal(gleam@any:int(gleam@any:from([])),
+ {error, <<"Expected an Int, got `[]`">>}).
+
+float_test() ->
+ gleam@expect:equal(gleam@any:float(gleam@any:from(1.0)), {ok, 1.0}),
+ gleam@expect:equal(gleam@any:float(gleam@any:from(2.2)), {ok, 2.2}),
+ gleam@expect:equal(gleam@any:float(gleam@any:from(1)),
+ {error, <<"Expected a Float, got `1`">>}),
+ gleam@expect:equal(gleam@any:float(gleam@any:from([])),
+ {error, <<"Expected a Float, got `[]`">>}).
+
+thunk_test() ->
+ gleam@expect:is_ok(gleam@any:thunk(gleam@any:from(fun() -> 1 end))),
+ gleam@expect:equal(gleam@result:map(gleam@any:thunk(gleam@any:from(fun() ->
+ 1
+ end)),
+ fun(F) -> F() end),
+ {ok, gleam@any:from(1)}),
+ gleam@expect:is_error(gleam@any:thunk(gleam@any:from(fun(X) -> X end))),
+ gleam@expect:is_error(gleam@any:thunk(gleam@any:from(1))),
+ gleam@expect:is_error(gleam@any:thunk(gleam@any:from([]))).
+
+bool_test() ->
+ gleam@expect:equal(gleam@any:bool(gleam@any:from(true)), {ok, true}),
+ gleam@expect:equal(gleam@any:bool(gleam@any:from(false)), {ok, false}),
+ gleam@expect:equal(gleam@any:bool(gleam@any:from(1)),
+ {error, <<"Expected a Bool, got `1`">>}),
+ gleam@expect:equal(gleam@any:bool(gleam@any:from([])),
+ {error, <<"Expected a Bool, got `[]`">>}).
+
+atom_test() ->
+ gleam@expect:equal(gleam@any:atom(gleam@any:from(gleam@atom:create_from_string(<<"">>))),
+ {ok, gleam@atom:create_from_string(<<"">>)}),
+ gleam@expect:equal(gleam@any:atom(gleam@any:from(gleam@atom:create_from_string(<<"ok">>))),
+ {ok, gleam@atom:create_from_string(<<"ok">>)}),
+ gleam@expect:is_error(gleam@any:atom(gleam@any:from(1))),
+ gleam@expect:is_error(gleam@any:atom(gleam@any:from([]))).
+
+list_test() ->
+ gleam@expect:equal(gleam@any:list(gleam@any:from([]),
+ fun gleam@any:string/1),
+ {ok, []}),
+ gleam@expect:equal(gleam@any:list(gleam@any:from([]), fun gleam@any:int/1),
+ {ok, []}),
+ gleam@expect:equal(gleam@any:list(gleam@any:from([1, 2, 3]),
+ fun gleam@any:int/1),
+ {ok, [1, 2, 3]}),
+ gleam@expect:equal(gleam@any:list(gleam@any:from([[1], [2], [3]]),
+ fun(Capture1) ->
+ gleam@any:list(Capture1,
+ fun gleam@any:int/1)
+ end),
+ {ok, [[1], [2], [3]]}),
+ gleam@expect:is_error(gleam@any:list(gleam@any:from(1),
+ fun gleam@any:string/1)),
+ gleam@expect:is_error(gleam@any:list(gleam@any:from(1.0),
+ fun gleam@any:int/1)),
+ gleam@expect:is_error(gleam@any:list(gleam@any:from([<<"">>]),
+ fun gleam@any:int/1)),
+ gleam@expect:is_error(gleam@any:list(gleam@any:from([gleam@any:from(1),
+ gleam@any:from(<<"not an int">>)]),
+ fun gleam@any:int/1)).
+
+tuple_test() ->
+ gleam@expect:equal(gleam@any:tuple(gleam@any:from({1, []})),
+ {ok, {gleam@any:from(1), gleam@any:from([])}}),
+ gleam@expect:equal(gleam@any:tuple(gleam@any:from({<<"ok">>, <<"ok">>})),
+ {ok,
+ {gleam@any:from(<<"ok">>), gleam@any:from(<<"ok">>)}}),
+ gleam@expect:is_error(gleam@any:tuple(gleam@any:from({1}))),
+ gleam@expect:is_error(gleam@any:tuple(gleam@any:from({1, 2, 3}))),
+ gleam@expect:equal(gleam@result:then(gleam@result:then(gleam@any:tuple(gleam@any:from({1,
+ 2.0})),
+ fun(X) ->
+ gleam@result:map(gleam@any:int(gleam@tuple:first(X)),
+ fun(F) ->
+ {F,
+ gleam@tuple:second(X)}
+ end)
+ end),
+ fun(X) ->
+ gleam@result:map(gleam@any:float(gleam@tuple:second(X)),
+ fun(F) ->
+ {gleam@tuple:first(X),
+ F}
+ end)
+ end),
+ {ok, {1, 2.0}}).
+
+field_test() ->
+ {ok, OkAtom} = gleam@atom:from_string(<<"ok">>),
+ gleam@expect:equal(gleam@any:field(gleam@any:from(#{}#{ok => 1}), OkAtom),
+ {ok, gleam@any:from(1)}),
+ gleam@expect:equal(gleam@any:field(gleam@any:from(#{}#{ok => 3}#{earlier => 2}),
+ OkAtom),
+ {ok, gleam@any:from(3)}),
+ gleam@expect:is_error(gleam@any:field(gleam@any:from(#{}), OkAtom)),
+ gleam@expect:is_error(gleam@any:field(gleam@any:from(1), OkAtom)),
+ gleam@expect:is_error(gleam@any:field(gleam@any:from([]), [])).
diff --git a/gen/test/gleam@atom_test.erl b/gen/test/gleam@atom_test.erl
new file mode 100644
index 0000000..d9c429c
--- /dev/null
+++ b/gen/test/gleam@atom_test.erl
@@ -0,0 +1,24 @@
+-module(gleam@atom_test).
+-compile(no_auto_import).
+
+-export([from_string_test/0, create_from_string_test/0, to_string_test/0]).
+
+from_string_test() ->
+ gleam@expect:is_ok(gleam@atom:from_string(<<"ok">>)),
+ gleam@expect:is_ok(gleam@atom:from_string(<<"expect">>)),
+ gleam@expect:is_error(gleam@atom:from_string(<<"this is not an atom we have seen before">>)).
+
+create_from_string_test() ->
+ gleam@expect:equal({ok, gleam@atom:create_from_string(<<"ok">>)},
+ gleam@atom:from_string(<<"ok">>)),
+ gleam@expect:equal({ok, gleam@atom:create_from_string(<<"expect">>)},
+ gleam@atom:from_string(<<"expect">>)),
+ gleam@expect:equal({ok,
+ gleam@atom:create_from_string(<<"this is another atom we have not seen before">>)},
+ gleam@atom:from_string(<<"this is another atom we have not seen before">>)).
+
+to_string_test() ->
+ gleam@expect:equal(gleam@atom:to_string(gleam@atom:create_from_string(<<"ok">>)),
+ <<"ok">>),
+ gleam@expect:equal(gleam@atom:to_string(gleam@atom:create_from_string(<<"expect">>)),
+ <<"expect">>).
diff --git a/gen/test/gleam@bool_test.erl b/gen/test/gleam@bool_test.erl
new file mode 100644
index 0000000..2a47516
--- /dev/null
+++ b/gen/test/gleam@bool_test.erl
@@ -0,0 +1,30 @@
+-module(gleam@bool_test).
+-compile(no_auto_import).
+
+-export([negate_test/0, compare_test/0, max_test/0, min_test/0, to_int_test/0]).
+
+negate_test() ->
+ gleam@expect:false(gleam@bool:negate(true)),
+ gleam@expect:true(gleam@bool:negate(false)).
+
+compare_test() ->
+ gleam@expect:equal(gleam@bool:compare(true, true), eq),
+ gleam@expect:equal(gleam@bool:compare(true, false), gt),
+ gleam@expect:equal(gleam@bool:compare(false, false), eq),
+ gleam@expect:equal(gleam@bool:compare(false, true), lt).
+
+max_test() ->
+ gleam@expect:equal(gleam@bool:max(true, true), true),
+ gleam@expect:equal(gleam@bool:max(true, false), true),
+ gleam@expect:equal(gleam@bool:max(false, false), false),
+ gleam@expect:equal(gleam@bool:max(false, true), true).
+
+min_test() ->
+ gleam@expect:equal(gleam@bool:min(true, true), true),
+ gleam@expect:equal(gleam@bool:min(true, false), false),
+ gleam@expect:equal(gleam@bool:min(false, false), false),
+ gleam@expect:equal(gleam@bool:min(false, true), false).
+
+to_int_test() ->
+ gleam@expect:equal(gleam@bool:to_int(true), 1),
+ gleam@expect:equal(gleam@bool:to_int(false), 0).
diff --git a/gen/test/gleam@float_test.erl b/gen/test/gleam@float_test.erl
new file mode 100644
index 0000000..ea19c5e
--- /dev/null
+++ b/gen/test/gleam@float_test.erl
@@ -0,0 +1,42 @@
+-module(gleam@float_test).
+-compile(no_auto_import).
+
+-export([parse_test/0, to_string_test/0, ceiling_test/0, floor_test/0, round_test/0, truncate_test/0]).
+
+parse_test() ->
+ gleam@expect:equal(gleam@float:parse(<<"1.23">>), {ok, 1.23}),
+ gleam@expect:equal(gleam@float:parse(<<"5.0">>), {ok, 5.0}),
+ gleam@expect:equal(gleam@float:parse(<<"0.123456789">>), {ok, 0.123456789}),
+ gleam@expect:is_error(gleam@float:parse(<<"">>)),
+ gleam@expect:is_error(gleam@float:parse(<<"what">>)),
+ gleam@expect:is_error(gleam@float:parse(<<"1">>)).
+
+to_string_test() ->
+ gleam@expect:equal(gleam@float:to_string(123.0), <<"123.0">>),
+ gleam@expect:equal(gleam@float:to_string(-8.1), <<"-8.1">>).
+
+ceiling_test() ->
+ gleam@expect:equal(gleam@float:ceiling(8.1), 9.0),
+ gleam@expect:equal(gleam@float:ceiling(-8.1), -8.0),
+ gleam@expect:equal(gleam@float:ceiling(-8.0), -8.0).
+
+floor_test() ->
+ gleam@expect:equal(gleam@float:floor(8.1), 8.0),
+ gleam@expect:equal(gleam@float:floor(-8.1), -9.0),
+ gleam@expect:equal(gleam@float:floor(-8.0), -8.0).
+
+round_test() ->
+ gleam@expect:equal(gleam@float:round(8.1), 8),
+ gleam@expect:equal(gleam@float:round(8.4), 8),
+ gleam@expect:equal(gleam@float:round(8.499), 8),
+ gleam@expect:equal(gleam@float:round(8.5), 9),
+ gleam@expect:equal(gleam@float:round(-8.1), -8),
+ gleam@expect:equal(gleam@float:round(-7.5), -8).
+
+truncate_test() ->
+ gleam@expect:equal(gleam@float:truncate(8.1), 8),
+ gleam@expect:equal(gleam@float:truncate(8.4), 8),
+ gleam@expect:equal(gleam@float:truncate(8.499), 8),
+ gleam@expect:equal(gleam@float:truncate(8.5), 8),
+ gleam@expect:equal(gleam@float:truncate(-8.1), -8),
+ gleam@expect:equal(gleam@float:truncate(-7.5), -7).
diff --git a/gen/test/std@http_test.erl b/gen/test/gleam@http_test.erl
index 14e2b40..6f54e78 100644
--- a/gen/test/std@http_test.erl
+++ b/gen/test/gleam@http_test.erl
@@ -1,4 +1,4 @@
--module(std@http_test).
+-module(gleam@http_test).
-compile(no_auto_import).
-export([]).
diff --git a/gen/test/gleam@int_test.erl b/gen/test/gleam@int_test.erl
new file mode 100644
index 0000000..1f13f1a
--- /dev/null
+++ b/gen/test/gleam@int_test.erl
@@ -0,0 +1,29 @@
+-module(gleam@int_test).
+-compile(no_auto_import).
+
+-export([to_string/0, parse/0, to_base_string/0, compare_test/0]).
+
+to_string() ->
+ gleam@expect:equal(gleam@int:to_string(123), <<"123">>),
+ gleam@expect:equal(gleam@int:to_string(-123), <<"-123">>),
+ gleam@expect:equal(gleam@int:to_string(123), <<"123">>).
+
+parse() ->
+ gleam@expect:equal(gleam@int:parse(<<"123">>), {ok, 123}),
+ gleam@expect:equal(gleam@int:parse(<<"-123">>), {ok, -123}),
+ gleam@expect:equal(gleam@int:parse(<<"0123">>), {ok, 123}),
+ gleam@expect:is_error(gleam@int:parse(<<"">>)),
+ gleam@expect:is_error(gleam@int:parse(<<"what">>)),
+ gleam@expect:is_error(gleam@int:parse(<<"1.23">>)).
+
+to_base_string() ->
+ gleam@expect:equal(gleam@int:to_base_string(100, 16), <<"64">>),
+ gleam@expect:equal(gleam@int:to_base_string(-100, 16), <<"-64">>).
+
+compare_test() ->
+ gleam@expect:equal(gleam@int:compare(0, 0), eq),
+ gleam@expect:equal(gleam@int:compare(1, 1), eq),
+ gleam@expect:equal(gleam@int:compare(0, 1), lt),
+ gleam@expect:equal(gleam@int:compare(-2, -1), lt),
+ gleam@expect:equal(gleam@int:compare(2, 1), gt),
+ gleam@expect:equal(gleam@int:compare(-1, -2), gt).
diff --git a/gen/test/gleam@iodata_test.erl b/gen/test/gleam@iodata_test.erl
new file mode 100644
index 0000000..621266c
--- /dev/null
+++ b/gen/test/gleam@iodata_test.erl
@@ -0,0 +1,58 @@
+-module(gleam@iodata_test).
+-compile(no_auto_import).
+
+-export([iodata_test/0, lowercase_test/0, uppercase_test/0, split_test/0, is_equal_test/0, is_empty_test/0]).
+
+iodata_test() ->
+ Data = gleam@iodata:prepend(gleam@iodata:append(gleam@iodata:append(gleam@iodata:new(<<"ello">>),
+ <<",">>),
+ <<" world!">>),
+ <<"H">>),
+ gleam@expect:equal(gleam@iodata:to_string(Data), <<"Hello, world!">>),
+ gleam@expect:equal(gleam@iodata:byte_size(Data), 13),
+ Data1 = gleam@iodata:prepend_iodata(gleam@iodata:append_iodata(gleam@iodata:append_iodata(gleam@iodata:new(<<"ello">>),
+ gleam@iodata:new(<<",">>)),
+ gleam@iodata:concat([gleam@iodata:new(<<" wo">>),
+ gleam@iodata:new(<<"rld!">>)])),
+ gleam@iodata:new(<<"H">>)),
+ gleam@expect:equal(gleam@iodata:to_string(Data1), <<"Hello, world!">>),
+ gleam@expect:equal(gleam@iodata:byte_size(Data1), 13).
+
+lowercase_test() ->
+ gleam@expect:equal(gleam@iodata:to_string(gleam@iodata:lowercase(gleam@iodata:from_strings([<<"Gleam">>,
+ <<"Gleam">>]))),
+ <<"gleamgleam">>).
+
+uppercase_test() ->
+ gleam@expect:equal(gleam@iodata:to_string(gleam@iodata:uppercase(gleam@iodata:from_strings([<<"Gleam">>,
+ <<"Gleam">>]))),
+ <<"GLEAMGLEAM">>).
+
+split_test() ->
+ gleam@expect:equal(gleam@iodata:split(gleam@iodata:new(<<"Gleam,Erlang,Elixir">>),
+ <<",">>),
+ [gleam@iodata:new(<<"Gleam">>),
+ gleam@iodata:new(<<"Erlang">>),
+ gleam@iodata:new(<<"Elixir">>)]),
+ gleam@expect:equal(gleam@iodata:split(gleam@iodata:from_strings([<<"Gleam, Erl">>,
+ <<"ang,Elixir">>]),
+ <<", ">>),
+ [gleam@iodata:new(<<"Gleam">>),
+ gleam@iodata:from_strings([<<"Erl">>,
+ <<"ang,Elixir">>])]).
+
+is_equal_test() ->
+ gleam@expect:true(gleam@iodata:is_equal(gleam@iodata:new(<<"12">>),
+ gleam@iodata:from_strings([<<"1">>,
+ <<"2">>]))),
+ gleam@expect:true(gleam@iodata:is_equal(gleam@iodata:new(<<"12">>),
+ gleam@iodata:new(<<"12">>))),
+ gleam@expect:false(gleam@iodata:is_equal(gleam@iodata:new(<<"12">>),
+ gleam@iodata:new(<<"2">>))).
+
+is_empty_test() ->
+ gleam@expect:true(gleam@iodata:is_empty(gleam@iodata:new(<<"">>))),
+ gleam@expect:false(gleam@iodata:is_empty(gleam@iodata:new(<<"12">>))),
+ gleam@expect:true(gleam@iodata:is_empty(gleam@iodata:from_strings([]))),
+ gleam@expect:true(gleam@iodata:is_empty(gleam@iodata:from_strings([<<"">>,
+ <<"">>]))).
diff --git a/gen/test/gleam@list_test.erl b/gen/test/gleam@list_test.erl
new file mode 100644
index 0000000..eda42d4
--- /dev/null
+++ b/gen/test/gleam@list_test.erl
@@ -0,0 +1,208 @@
+-module(gleam@list_test).
+-compile(no_auto_import).
+
+-export([length_test/0, reverse_test/0, is_empty_test/0, contains_test/0, head_test/0, tail_test/0, filter_test/0, map_test/0, traverse_test/0, drop_test/0, take_test/0, new_test/0, append_test/0, flatten_test/0, fold_test/0, fold_right_test/0, find_test/0, all_test/0, any_test/0, zip_test/0, strict_zip_test/0, intersperse_test/0, at_test/0, unique_test/0, sort_test/0, index_map_test/0, range_test/0, repeat_test/0, split_test/0, split_while_test/0]).
+
+length_test() ->
+ gleam@expect:equal(gleam@list:length([]), 0),
+ gleam@expect:equal(gleam@list:length([1]), 1),
+ gleam@expect:equal(gleam@list:length([1, 1]), 2),
+ gleam@expect:equal(gleam@list:length([1, 1, 1]), 3).
+
+reverse_test() ->
+ gleam@expect:equal(gleam@list:reverse([]), []),
+ gleam@expect:equal(gleam@list:reverse([1, 2, 3, 4, 5]), [5, 4, 3, 2, 1]).
+
+is_empty_test() ->
+ gleam@expect:true(gleam@list:is_empty([])),
+ gleam@expect:false(gleam@list:is_empty([1])).
+
+contains_test() ->
+ gleam@expect:true(gleam@list:contains([0, 4, 5, 1], 1)),
+ gleam@expect:false(gleam@list:contains([0, 4, 5, 7], 1)),
+ gleam@expect:false(gleam@list:contains([], 1)).
+
+head_test() ->
+ gleam@expect:equal(gleam@list:head([0, 4, 5, 7]), {ok, 0}),
+ gleam@expect:is_error(gleam@list:head([])).
+
+tail_test() ->
+ gleam@expect:equal(gleam@list:tail([0, 4, 5, 7]), {ok, [4, 5, 7]}),
+ gleam@expect:equal(gleam@list:tail([0]), {ok, []}),
+ gleam@expect:is_error(gleam@list:tail([])).
+
+filter_test() ->
+ gleam@expect:equal(gleam@list:filter([], fun(_) -> true end), []),
+ gleam@expect:equal(gleam@list:filter([0, 4, 5, 7, 3], fun(_) -> true end),
+ [0, 4, 5, 7, 3]),
+ gleam@expect:equal(gleam@list:filter([0, 4, 5, 7, 3], fun(X) -> X > 4 end),
+ [5, 7]),
+ gleam@expect:equal(gleam@list:filter([0, 4, 5, 7, 3], fun(X) -> X < 4 end),
+ [0, 3]).
+
+map_test() ->
+ gleam@expect:equal(gleam@list:map([], fun(X) -> X * 2 end), []),
+ gleam@expect:equal(gleam@list:map([0, 4, 5, 7, 3], fun(X) -> X * 2 end),
+ [0, 8, 10, 14, 6]).
+
+traverse_test() ->
+ Fun = fun(X) -> case X =:= 6 orelse X =:= 5 orelse X =:= 4 of
+ true ->
+ {ok, X * 2};
+
+ false ->
+ {error, X}
+ end end,
+ gleam@expect:equal(gleam@list:traverse([5, 6, 5, 6], Fun),
+ {ok, [10, 12, 10, 12]}),
+ gleam@expect:equal(gleam@list:traverse([4, 6, 5, 7, 3], Fun), {error, 7}).
+
+drop_test() ->
+ gleam@expect:equal(gleam@list:drop([], 5), []),
+ gleam@expect:equal(gleam@list:drop([1, 2, 3, 4, 5, 6, 7, 8], 5), [6, 7, 8]).
+
+take_test() ->
+ gleam@expect:equal(gleam@list:take([], 5), []),
+ gleam@expect:equal(gleam@list:take([1, 2, 3, 4, 5, 6, 7, 8], 5),
+ [1, 2, 3, 4, 5]).
+
+new_test() ->
+ gleam@expect:equal(gleam@list:new(), []).
+
+append_test() ->
+ gleam@expect:equal(gleam@list:append([1], [2, 3]), [1, 2, 3]).
+
+flatten_test() ->
+ gleam@expect:equal(gleam@list:flatten([]), []),
+ gleam@expect:equal(gleam@list:flatten([[]]), []),
+ gleam@expect:equal(gleam@list:flatten([[], [], []]), []),
+ gleam@expect:equal(gleam@list:flatten([[1, 2], [], [3, 4]]), [1, 2, 3, 4]).
+
+fold_test() ->
+ gleam@expect:equal(gleam@list:fold([1, 2, 3],
+ [],
+ fun(X, Acc) -> [X | Acc] end),
+ [3, 2, 1]).
+
+fold_right_test() ->
+ gleam@expect:equal(gleam@list:fold_right([1, 2, 3],
+ [],
+ fun(X, Acc) -> [X | Acc] end),
+ [1, 2, 3]).
+
+find_test() ->
+ F = fun(X) -> case X of
+ 2 ->
+ {ok, 4};
+
+ _ ->
+ {error, 0}
+ end end,
+ gleam@expect:equal(gleam@list:find([1, 2, 3], F), {ok, 4}),
+ gleam@expect:equal(gleam@list:find([1, 3, 2], F), {ok, 4}),
+ gleam@expect:is_error(gleam@list:find([1, 3], F)).
+
+all_test() ->
+ gleam@expect:equal(gleam@list:all([1, 2, 3, 4, 5], fun(X) -> X > 0 end),
+ true),
+ gleam@expect:equal(gleam@list:all([1, 2, 3, 4, 5], fun(X) -> X < 0 end),
+ false),
+ gleam@expect:equal(gleam@list:all([], fun(_) -> false end), true).
+
+any_test() ->
+ gleam@expect:equal(gleam@list:any([1, 2, 3, 4, 5], fun(X) -> X =:= 2 end),
+ true),
+ gleam@expect:equal(gleam@list:any([1, 2, 3, 4, 5], fun(X) -> X < 0 end),
+ false),
+ gleam@expect:equal(gleam@list:any([], fun(_) -> false end), false).
+
+zip_test() ->
+ gleam@expect:equal(gleam@list:zip([], [1, 2, 3]), []),
+ gleam@expect:equal(gleam@list:zip([1, 2], []), []),
+ gleam@expect:equal(gleam@list:zip([1, 2, 3], [4, 5, 6]),
+ [{1, 4}, {2, 5}, {3, 6}]),
+ gleam@expect:equal(gleam@list:zip([5, 6], [1, 2, 3]), [{5, 1}, {6, 2}]),
+ gleam@expect:equal(gleam@list:zip([5, 6, 7], [1, 2]), [{5, 1}, {6, 2}]).
+
+strict_zip_test() ->
+ gleam@expect:is_error(gleam@list:strict_zip([], [1, 2, 3])),
+ gleam@expect:is_error(gleam@list:strict_zip([1, 2], [])),
+ gleam@expect:equal(gleam@list:strict_zip([1, 2, 3], [4, 5, 6]),
+ {ok, [{1, 4}, {2, 5}, {3, 6}]}),
+ gleam@expect:is_error(gleam@list:strict_zip([5, 6], [1, 2, 3])),
+ gleam@expect:is_error(gleam@list:strict_zip([5, 6, 7], [1, 2])).
+
+intersperse_test() ->
+ gleam@expect:equal(gleam@list:intersperse([1, 2, 3], 4), [1, 4, 2, 4, 3]),
+ gleam@expect:equal(gleam@list:intersperse([], 2), []).
+
+at_test() ->
+ gleam@expect:equal(gleam@list:at([1, 2, 3], 2), {ok, 3}),
+ gleam@expect:is_error(gleam@list:at([1, 2, 3], 5)),
+ gleam@expect:is_error(gleam@list:at([], 0)),
+ gleam@expect:is_error(gleam@list:at([1, 2, 3, 4, 5, 6], -1)).
+
+unique_test() ->
+ gleam@expect:equal(gleam@list:unique([1, 1, 2, 3, 4, 4, 4, 5, 6]),
+ [1, 2, 3, 4, 5, 6]),
+ gleam@expect:equal(gleam@list:unique([7, 1, 45, 6, 2, 47, 2, 7, 5]),
+ [7, 1, 45, 6, 2, 47, 5]),
+ gleam@expect:equal(gleam@list:unique([3, 4, 5]), [3, 4, 5]),
+ gleam@expect:equal(gleam@list:unique([]), []).
+
+sort_test() ->
+ gleam@expect:equal(gleam@list:sort([4, 3, 6, 5, 4]), [3, 4, 4, 5, 6]),
+ gleam@expect:equal(gleam@list:sort([]), []),
+ gleam@expect:equal(gleam@list:sort([{1, 2}, {4, 5}, {3, 2}]),
+ [{1, 2}, {3, 2}, {4, 5}]).
+
+index_map_test() ->
+ gleam@expect:equal(gleam@list:index_map([3, 4, 5], fun(I, X) -> {I, X} end),
+ [{0, 3}, {1, 4}, {2, 5}]),
+ F = fun(I, X) -> gleam@string:append(X, gleam@int:to_string(I)) end,
+ gleam@expect:equal(gleam@list:index_map([<<"a">>, <<"b">>, <<"c">>], F),
+ [<<"a0">>, <<"b1">>, <<"c2">>]).
+
+range_test() ->
+ gleam@expect:equal(gleam@list:range(0, 0), []),
+ gleam@expect:equal(gleam@list:range(1, 1), []),
+ gleam@expect:equal(gleam@list:range(-1, -1), []),
+ gleam@expect:equal(gleam@list:range(0, 1), [0]),
+ gleam@expect:equal(gleam@list:range(0, 5), [0, 1, 2, 3, 4]),
+ gleam@expect:equal(gleam@list:range(1, -5), [1, 0, -1, -2, -3, -4]).
+
+repeat_test() ->
+ gleam@expect:equal(gleam@list:repeat(1, -10), []),
+ gleam@expect:equal(gleam@list:repeat(1, 0), []),
+ gleam@expect:equal(gleam@list:repeat(2, 3), [2, 2, 2]),
+ gleam@expect:equal(gleam@list:repeat(<<"x">>, 5),
+ [<<"x">>, <<"x">>, <<"x">>, <<"x">>, <<"x">>]).
+
+split_test() ->
+ gleam@expect:equal(gleam@list:split([], 0), {[], []}),
+ gleam@expect:equal(gleam@list:split([0, 1, 2, 3, 4], 0),
+ {[], [0, 1, 2, 3, 4]}),
+ gleam@expect:equal(gleam@list:split([0, 1, 2, 3, 4], -2),
+ {[], [0, 1, 2, 3, 4]}),
+ gleam@expect:equal(gleam@list:split([0, 1, 2, 3, 4], 1),
+ {[0], [1, 2, 3, 4]}),
+ gleam@expect:equal(gleam@list:split([0, 1, 2, 3, 4], 3),
+ {[0, 1, 2], [3, 4]}),
+ gleam@expect:equal(gleam@list:split([0, 1, 2, 3, 4], 9),
+ {[0, 1, 2, 3, 4], []}).
+
+split_while_test() ->
+ gleam@expect:equal(gleam@list:split_while([], fun(X) -> X =< 5 end),
+ {[], []}),
+ gleam@expect:equal(gleam@list:split_while([1, 2, 3, 4, 5],
+ fun(X) -> X =< 5 end),
+ {[1, 2, 3, 4, 5], []}),
+ gleam@expect:equal(gleam@list:split_while([1, 2, 3, 4, 5],
+ fun(X) -> X =:= 2 end),
+ {[], [1, 2, 3, 4, 5]}),
+ gleam@expect:equal(gleam@list:split_while([1, 2, 3, 4, 5],
+ fun(X) -> X =< 3 end),
+ {[1, 2, 3], [4, 5]}),
+ gleam@expect:equal(gleam@list:split_while([1, 2, 3, 4, 5],
+ fun(X) -> X =< -3 end),
+ {[], [1, 2, 3, 4, 5]}).
diff --git a/gen/test/gleam@map_dict_test.erl b/gen/test/gleam@map_dict_test.erl
new file mode 100644
index 0000000..f19f735
--- /dev/null
+++ b/gen/test/gleam@map_dict_test.erl
@@ -0,0 +1,151 @@
+-module(gleam@map_dict_test).
+-compile(no_auto_import).
+
+-export([from_list_test/0, has_key_test/0, new_test/0, fetch_test/0, put_test/0, map_values_test/0, keys_test/0, values_test/0, take_test/0, drop_test/0, merge_test/0, delete_test/0, update_test/0, fold_test/0]).
+
+from_list_test() ->
+ gleam@expect:equal(gleam@map_dict:size(gleam@map_dict:from_list([{4, 0},
+ {1, 0}])),
+ 2).
+
+has_key_test() ->
+ gleam@expect:false(gleam@map_dict:has_key(gleam@map_dict:from_list([]), 1)),
+ gleam@expect:true(gleam@map_dict:has_key(gleam@map_dict:from_list([{1, 0}]),
+ 1)),
+ gleam@expect:true(gleam@map_dict:has_key(gleam@map_dict:from_list([{4, 0},
+ {1, 0}]),
+ 1)),
+ gleam@expect:false(gleam@map_dict:has_key(gleam@map_dict:from_list([{4, 0},
+ {1, 0}]),
+ 0)).
+
+new_test() ->
+ gleam@expect:equal(gleam@map_dict:size(gleam@map_dict:new()), 0),
+ gleam@expect:equal(gleam@map_dict:to_list(gleam@map_dict:new()), []).
+
+fetch_test() ->
+ Proplist = [{4, 0}, {1, 1}],
+ M = gleam@map_dict:from_list(Proplist),
+ gleam@expect:equal(gleam@map_dict:fetch(M, 4), {ok, 0}),
+ gleam@expect:equal(gleam@map_dict:fetch(M, 1), {ok, 1}),
+ gleam@expect:is_error(gleam@map_dict:fetch(M, 2)).
+
+put_test() ->
+ gleam@expect:equal(gleam@map_dict:put(gleam@map_dict:put(gleam@map_dict:put(gleam@map_dict:new(),
+ <<"a">>,
+ 0),
+ <<"b">>,
+ 1),
+ <<"c">>,
+ 2),
+ gleam@map_dict:from_list([{<<"a">>, 0},
+ {<<"b">>, 1},
+ {<<"c">>, 2}])).
+
+map_values_test() ->
+ gleam@expect:equal(gleam@map_dict:map_values(gleam@map_dict:from_list([{1,
+ 0},
+ {2,
+ 1},
+ {3,
+ 2}]),
+ fun(K, V) -> K + V end),
+ gleam@map_dict:from_list([{1, 1}, {2, 3}, {3, 5}])).
+
+keys_test() ->
+ gleam@expect:equal(gleam@map_dict:keys(gleam@map_dict:from_list([{<<"a">>,
+ 0},
+ {<<"b">>,
+ 1},
+ {<<"c">>,
+ 2}])),
+ [<<"a">>, <<"b">>, <<"c">>]).
+
+values_test() ->
+ gleam@expect:equal(gleam@map_dict:values(gleam@map_dict:from_list([{<<"a">>,
+ 0},
+ {<<"b">>,
+ 1},
+ {<<"c">>,
+ 2}])),
+ [0, 1, 2]).
+
+take_test() ->
+ gleam@expect:equal(gleam@map_dict:take(gleam@map_dict:from_list([{<<"a">>,
+ 0},
+ {<<"b">>,
+ 1},
+ {<<"c">>,
+ 2}]),
+ [<<"a">>, <<"b">>, <<"d">>]),
+ gleam@map_dict:from_list([{<<"a">>, 0}, {<<"b">>, 1}])).
+
+drop_test() ->
+ gleam@expect:equal(gleam@map_dict:drop(gleam@map_dict:from_list([{<<"a">>,
+ 0},
+ {<<"b">>,
+ 1},
+ {<<"c">>,
+ 2}]),
+ [<<"a">>, <<"b">>, <<"d">>]),
+ gleam@map_dict:from_list([{<<"c">>, 2}])).
+
+merge_test() ->
+ A = gleam@map_dict:from_list([{<<"a">>, 2}, {<<"c">>, 4}, {<<"d">>, 3}]),
+ B = gleam@map_dict:from_list([{<<"a">>, 0}, {<<"b">>, 1}, {<<"c">>, 2}]),
+ gleam@expect:equal(gleam@map_dict:merge(A, B),
+ gleam@map_dict:from_list([{<<"a">>, 0},
+ {<<"b">>, 1},
+ {<<"c">>, 2},
+ {<<"d">>, 3}])),
+ gleam@expect:equal(gleam@map_dict:merge(B, A),
+ gleam@map_dict:from_list([{<<"a">>, 2},
+ {<<"b">>, 1},
+ {<<"c">>, 4},
+ {<<"d">>, 3}])).
+
+delete_test() ->
+ gleam@expect:equal(gleam@map_dict:delete(gleam@map_dict:delete(gleam@map_dict:from_list([{<<"a">>,
+ 0},
+ {<<"b">>,
+ 1},
+ {<<"c">>,
+ 2}]),
+ <<"a">>),
+ <<"d">>),
+ gleam@map_dict:from_list([{<<"b">>, 1}, {<<"c">>, 2}])).
+
+update_test() ->
+ Dict = gleam@map_dict:from_list([{<<"a">>, 0}, {<<"b">>, 1}, {<<"c">>, 2}]),
+ IncOrZero = fun(X) -> case X of
+ {ok, I} ->
+ I + 1;
+
+ {error, _} ->
+ 0
+ end end,
+ gleam@expect:equal(gleam@map_dict:update(Dict, <<"a">>, IncOrZero),
+ gleam@map_dict:from_list([{<<"a">>, 1},
+ {<<"b">>, 1},
+ {<<"c">>, 2}])),
+ gleam@expect:equal(gleam@map_dict:update(Dict, <<"b">>, IncOrZero),
+ gleam@map_dict:from_list([{<<"a">>, 0},
+ {<<"b">>, 2},
+ {<<"c">>, 2}])),
+ gleam@expect:equal(gleam@map_dict:update(Dict, <<"z">>, IncOrZero),
+ gleam@map_dict:from_list([{<<"a">>, 0},
+ {<<"b">>, 1},
+ {<<"c">>, 2},
+ {<<"z">>, 0}])).
+
+fold_test() ->
+ Dict = gleam@map_dict:from_list([{<<"a">>, 0},
+ {<<"b">>, 1},
+ {<<"c">>, 2},
+ {<<"d">>, 3}]),
+ Add = fun(_, V, Acc) -> V + Acc end,
+ gleam@expect:equal(gleam@map_dict:fold(Dict, 0, Add), 6),
+ Concat = fun(K, _, Acc) -> gleam@string:append(Acc, K) end,
+ gleam@expect:equal(gleam@map_dict:fold(Dict, <<"">>, Concat), <<"abcd">>),
+ gleam@expect:equal(gleam@map_dict:fold(gleam@map_dict:from_list([]), 0, Add),
+ 0).
diff --git a/gen/test/gleam@order_test.erl b/gen/test/gleam@order_test.erl
new file mode 100644
index 0000000..d9525c6
--- /dev/null
+++ b/gen/test/gleam@order_test.erl
@@ -0,0 +1,47 @@
+-module(gleam@order_test).
+-compile(no_auto_import).
+
+-export([reverse_test/0, to_int_test/0, compare_test/0, max_test/0, min_test/0]).
+
+reverse_test() ->
+ gleam@expect:equal(gleam@order:reverse(lt), gt),
+ gleam@expect:equal(gleam@order:reverse(eq), eq),
+ gleam@expect:equal(gleam@order:reverse(gt), lt).
+
+to_int_test() ->
+ gleam@expect:equal(gleam@order:to_int(lt), -1),
+ gleam@expect:equal(gleam@order:to_int(eq), 0),
+ gleam@expect:equal(gleam@order:to_int(gt), 1).
+
+compare_test() ->
+ gleam@expect:equal(gleam@order:compare(lt, lt), eq),
+ gleam@expect:equal(gleam@order:compare(lt, eq), lt),
+ gleam@expect:equal(gleam@order:compare(lt, gt), lt),
+ gleam@expect:equal(gleam@order:compare(eq, lt), gt),
+ gleam@expect:equal(gleam@order:compare(eq, eq), eq),
+ gleam@expect:equal(gleam@order:compare(eq, gt), lt),
+ gleam@expect:equal(gleam@order:compare(gt, lt), gt),
+ gleam@expect:equal(gleam@order:compare(gt, eq), gt),
+ gleam@expect:equal(gleam@order:compare(gt, gt), eq).
+
+max_test() ->
+ gleam@expect:equal(gleam@order:max(lt, lt), lt),
+ gleam@expect:equal(gleam@order:max(lt, eq), eq),
+ gleam@expect:equal(gleam@order:max(lt, gt), gt),
+ gleam@expect:equal(gleam@order:max(eq, lt), eq),
+ gleam@expect:equal(gleam@order:max(eq, eq), eq),
+ gleam@expect:equal(gleam@order:max(eq, gt), gt),
+ gleam@expect:equal(gleam@order:max(gt, lt), gt),
+ gleam@expect:equal(gleam@order:max(gt, eq), gt),
+ gleam@expect:equal(gleam@order:max(gt, gt), gt).
+
+min_test() ->
+ gleam@expect:equal(gleam@order:min(lt, lt), lt),
+ gleam@expect:equal(gleam@order:min(lt, eq), lt),
+ gleam@expect:equal(gleam@order:min(lt, gt), lt),
+ gleam@expect:equal(gleam@order:min(eq, lt), lt),
+ gleam@expect:equal(gleam@order:min(eq, eq), eq),
+ gleam@expect:equal(gleam@order:min(eq, gt), eq),
+ gleam@expect:equal(gleam@order:min(gt, lt), lt),
+ gleam@expect:equal(gleam@order:min(gt, eq), eq),
+ gleam@expect:equal(gleam@order:min(gt, gt), gt).
diff --git a/gen/test/gleam@result_test.erl b/gen/test/gleam@result_test.erl
new file mode 100644
index 0000000..e246694
--- /dev/null
+++ b/gen/test/gleam@result_test.erl
@@ -0,0 +1,47 @@
+-module(gleam@result_test).
+-compile(no_auto_import).
+
+-export([is_ok_test/0, is_error_test/0, map_test/0, map_error_test/0, flatten_test/0, then_test/0, unwrap_test/0]).
+
+is_ok_test() ->
+ gleam@expect:true(gleam@result:is_ok({ok, 1})),
+ gleam@expect:false(gleam@result:is_ok({error, 1})).
+
+is_error_test() ->
+ gleam@expect:false(gleam@result:is_error({ok, 1})),
+ gleam@expect:true(gleam@result:is_error({error, 1})).
+
+map_test() ->
+ gleam@expect:equal(gleam@result:map({ok, 1}, fun(X) -> X + 1 end), {ok, 2}),
+ gleam@expect:equal(gleam@result:map({ok, 1}, fun(_) -> <<"2">> end),
+ {ok, <<"2">>}),
+ gleam@expect:equal(gleam@result:map({error, 1}, fun(X) -> X + 1 end),
+ {error, 1}).
+
+map_error_test() ->
+ gleam@expect:equal(gleam@result:map_error({ok, 1}, fun(X) -> X + 1 end),
+ {ok, 1}),
+ gleam@expect:equal(gleam@result:map_error({error, 1}, fun(X) -> X + 1 end),
+ {error, 2}).
+
+flatten_test() ->
+ gleam@expect:equal(gleam@result:flatten({ok, {ok, 1}}), {ok, 1}),
+ gleam@expect:equal(gleam@result:flatten({ok, {error, 1}}), {error, 1}),
+ gleam@expect:equal(gleam@result:flatten({error, 1}), {error, 1}),
+ gleam@expect:equal(gleam@result:flatten({error, {error, 1}}),
+ {error, {error, 1}}).
+
+then_test() ->
+ gleam@expect:equal(gleam@result:then({error, 1}, fun(X) -> {ok, X + 1} end),
+ {error, 1}),
+ gleam@expect:equal(gleam@result:then({ok, 1}, fun(X) -> {ok, X + 1} end),
+ {ok, 2}),
+ gleam@expect:equal(gleam@result:then({ok, 1},
+ fun(_) -> {ok, <<"type change">>} end),
+ {ok, <<"type change">>}),
+ gleam@expect:equal(gleam@result:then({ok, 1}, fun(_) -> {error, 1} end),
+ {error, 1}).
+
+unwrap_test() ->
+ gleam@expect:equal(gleam@result:unwrap({ok, 1}, 50), 1),
+ gleam@expect:equal(gleam@result:unwrap({error, <<"nope">>}, 50), 50).
diff --git a/gen/test/gleam@string_test.erl b/gen/test/gleam@string_test.erl
new file mode 100644
index 0000000..5d1d912
--- /dev/null
+++ b/gen/test/gleam@string_test.erl
@@ -0,0 +1,34 @@
+-module(gleam@string_test).
+-compile(no_auto_import).
+
+-export([length_test/0, lowercase_test/0, uppercase_test/0, reverse_test/0, split_test/0, replace_test/0, append_test/0]).
+
+length_test() ->
+ gleam@expect:equal(gleam@string:length(<<"ß↑e̊">>), 3),
+ gleam@expect:equal(gleam@string:length(<<"Gleam">>), 5),
+ gleam@expect:equal(gleam@string:length(<<"">>), 0).
+
+lowercase_test() ->
+ gleam@expect:equal(gleam@string:lowercase(<<"Gleam">>), <<"gleam">>).
+
+uppercase_test() ->
+ gleam@expect:equal(gleam@string:uppercase(<<"Gleam">>), <<"GLEAM">>).
+
+reverse_test() ->
+ gleam@expect:equal(gleam@string:reverse(<<"Gleam">>), <<"maelG">>).
+
+split_test() ->
+ gleam@expect:equal(gleam@string:split(<<"Gleam,Erlang,Elixir">>, <<",">>),
+ [<<"Gleam">>, <<"Erlang">>, <<"Elixir">>]),
+ gleam@expect:equal(gleam@string:split(<<"Gleam, Erlang,Elixir">>, <<", ">>),
+ [<<"Gleam">>, <<"Erlang,Elixir">>]).
+
+replace_test() ->
+ gleam@expect:equal(gleam@string:replace(<<"Gleam,Erlang,Elixir">>,
+ <<",">>,
+ <<"++">>),
+ <<"Gleam++Erlang++Elixir">>).
+
+append_test() ->
+ gleam@expect:equal(gleam@string:append(<<"Test">>, <<" Me">>),
+ <<"Test Me">>).
diff --git a/gen/test/gleam@tuple_test.erl b/gen/test/gleam@tuple_test.erl
new file mode 100644
index 0000000..c705c74
--- /dev/null
+++ b/gen/test/gleam@tuple_test.erl
@@ -0,0 +1,23 @@
+-module(gleam@tuple_test).
+-compile(no_auto_import).
+
+-export([new_test/0, first_test/0, second_test/0, swap_test/0, fetch_test/0]).
+
+new_test() ->
+ gleam@expect:equal(gleam@tuple:new(1, 2), {1, 2}),
+ gleam@expect:equal(gleam@tuple:new(2, <<"3">>), {2, <<"3">>}).
+
+first_test() ->
+ gleam@expect:equal(gleam@tuple:first({1, 2}), 1).
+
+second_test() ->
+ gleam@expect:equal(gleam@tuple:second({1, 2}), 2).
+
+swap_test() ->
+ gleam@expect:equal(gleam@tuple:swap({1, <<"2">>}), {<<"2">>, 1}).
+
+fetch_test() ->
+ Proplist = [{0, <<"1">>}, {1, <<"2">>}],
+ gleam@expect:equal(gleam@tuple:fetch(Proplist, 0), {ok, <<"1">>}),
+ gleam@expect:equal(gleam@tuple:fetch(Proplist, 1), {ok, <<"2">>}),
+ gleam@expect:is_error(gleam@tuple:fetch(Proplist, 2)).
diff --git a/gen/test/std@any_test.erl b/gen/test/std@any_test.erl
deleted file mode 100644
index 3164919..0000000
--- a/gen/test/std@any_test.erl
+++ /dev/null
@@ -1,110 +0,0 @@
--module(std@any_test).
--compile(no_auto_import).
-
--export([string_test/0, int_test/0, float_test/0, thunk_test/0, bool_test/0, atom_test/0, list_test/0, tuple_test/0, field_test/0]).
-
-string_test() ->
- std@expect:equal(std@any:string(std@any:from(<<"">>)), {ok, <<"">>}),
- std@expect:equal(std@any:string(std@any:from(<<"Hello">>)),
- {ok, <<"Hello">>}),
- std@expect:equal(std@any:string(std@any:from(1)),
- {error, <<"Expected a String, got `1`">>}),
- std@expect:equal(std@any:string(std@any:from([])),
- {error, <<"Expected a String, got `[]`">>}).
-
-int_test() ->
- std@expect:equal(std@any:int(std@any:from(1)), {ok, 1}),
- std@expect:equal(std@any:int(std@any:from(2)), {ok, 2}),
- std@expect:equal(std@any:int(std@any:from(1.0)),
- {error, <<"Expected an Int, got `1.0`">>}),
- std@expect:equal(std@any:int(std@any:from([])),
- {error, <<"Expected an Int, got `[]`">>}).
-
-float_test() ->
- std@expect:equal(std@any:float(std@any:from(1.0)), {ok, 1.0}),
- std@expect:equal(std@any:float(std@any:from(2.2)), {ok, 2.2}),
- std@expect:equal(std@any:float(std@any:from(1)),
- {error, <<"Expected a Float, got `1`">>}),
- std@expect:equal(std@any:float(std@any:from([])),
- {error, <<"Expected a Float, got `[]`">>}).
-
-thunk_test() ->
- std@expect:is_ok(std@any:thunk(std@any:from(fun() -> 1 end))),
- std@expect:equal(std@result:map(std@any:thunk(std@any:from(fun() -> 1 end)),
- fun(F) -> F() end),
- {ok, std@any:from(1)}),
- std@expect:is_error(std@any:thunk(std@any:from(fun(X) -> X end))),
- std@expect:is_error(std@any:thunk(std@any:from(1))),
- std@expect:is_error(std@any:thunk(std@any:from([]))).
-
-bool_test() ->
- std@expect:equal(std@any:bool(std@any:from(true)), {ok, true}),
- std@expect:equal(std@any:bool(std@any:from(false)), {ok, false}),
- std@expect:equal(std@any:bool(std@any:from(1)),
- {error, <<"Expected a Bool, got `1`">>}),
- std@expect:equal(std@any:bool(std@any:from([])),
- {error, <<"Expected a Bool, got `[]`">>}).
-
-atom_test() ->
- std@expect:equal(std@any:atom(std@any:from(std@atom:create_from_string(<<"">>))),
- {ok, std@atom:create_from_string(<<"">>)}),
- std@expect:equal(std@any:atom(std@any:from(std@atom:create_from_string(<<"ok">>))),
- {ok, std@atom:create_from_string(<<"ok">>)}),
- std@expect:is_error(std@any:atom(std@any:from(1))),
- std@expect:is_error(std@any:atom(std@any:from([]))).
-
-list_test() ->
- std@expect:equal(std@any:list(std@any:from([]), fun std@any:string/1),
- {ok, []}),
- std@expect:equal(std@any:list(std@any:from([]), fun std@any:int/1),
- {ok, []}),
- std@expect:equal(std@any:list(std@any:from([1, 2, 3]), fun std@any:int/1),
- {ok, [1, 2, 3]}),
- std@expect:equal(std@any:list(std@any:from([[1], [2], [3]]),
- fun(Capture1) ->
- std@any:list(Capture1, fun std@any:int/1)
- end),
- {ok, [[1], [2], [3]]}),
- std@expect:is_error(std@any:list(std@any:from(1), fun std@any:string/1)),
- std@expect:is_error(std@any:list(std@any:from(1.0), fun std@any:int/1)),
- std@expect:is_error(std@any:list(std@any:from([<<"">>]),
- fun std@any:int/1)),
- std@expect:is_error(std@any:list(std@any:from([std@any:from(1),
- std@any:from(<<"not an int">>)]),
- fun std@any:int/1)).
-
-tuple_test() ->
- std@expect:equal(std@any:tuple(std@any:from({1, []})),
- {ok, {std@any:from(1), std@any:from([])}}),
- std@expect:equal(std@any:tuple(std@any:from({<<"ok">>, <<"ok">>})),
- {ok, {std@any:from(<<"ok">>), std@any:from(<<"ok">>)}}),
- std@expect:is_error(std@any:tuple(std@any:from({1}))),
- std@expect:is_error(std@any:tuple(std@any:from({1, 2, 3}))),
- std@expect:equal(std@result:then(std@result:then(std@any:tuple(std@any:from({1,
- 2.0})),
- fun(X) ->
- std@result:map(std@any:int(std@tuple:first(X)),
- fun(F) ->
- {F,
- std@tuple:second(X)}
- end)
- end),
- fun(X) ->
- std@result:map(std@any:float(std@tuple:second(X)),
- fun(F) ->
- {std@tuple:first(X),
- F}
- end)
- end),
- {ok, {1, 2.0}}).
-
-field_test() ->
- {ok, OkAtom} = std@atom:from_string(<<"ok">>),
- std@expect:equal(std@any:field(std@any:from(#{}#{ok => 1}), OkAtom),
- {ok, std@any:from(1)}),
- std@expect:equal(std@any:field(std@any:from(#{}#{ok => 3}#{earlier => 2}),
- OkAtom),
- {ok, std@any:from(3)}),
- std@expect:is_error(std@any:field(std@any:from(#{}), OkAtom)),
- std@expect:is_error(std@any:field(std@any:from(1), OkAtom)),
- std@expect:is_error(std@any:field(std@any:from([]), [])).
diff --git a/gen/test/std@atom_test.erl b/gen/test/std@atom_test.erl
deleted file mode 100644
index 20629d9..0000000
--- a/gen/test/std@atom_test.erl
+++ /dev/null
@@ -1,24 +0,0 @@
--module(std@atom_test).
--compile(no_auto_import).
-
--export([from_string_test/0, create_from_string_test/0, to_string_test/0]).
-
-from_string_test() ->
- std@expect:is_ok(std@atom:from_string(<<"ok">>)),
- std@expect:is_ok(std@atom:from_string(<<"expect">>)),
- std@expect:is_error(std@atom:from_string(<<"this is not an atom we have seen before">>)).
-
-create_from_string_test() ->
- std@expect:equal({ok, std@atom:create_from_string(<<"ok">>)},
- std@atom:from_string(<<"ok">>)),
- std@expect:equal({ok, std@atom:create_from_string(<<"expect">>)},
- std@atom:from_string(<<"expect">>)),
- std@expect:equal({ok,
- std@atom:create_from_string(<<"this is another atom we have not seen before">>)},
- std@atom:from_string(<<"this is another atom we have not seen before">>)).
-
-to_string_test() ->
- std@expect:equal(std@atom:to_string(std@atom:create_from_string(<<"ok">>)),
- <<"ok">>),
- std@expect:equal(std@atom:to_string(std@atom:create_from_string(<<"expect">>)),
- <<"expect">>).
diff --git a/gen/test/std@bool_test.erl b/gen/test/std@bool_test.erl
deleted file mode 100644
index 0679cb1..0000000
--- a/gen/test/std@bool_test.erl
+++ /dev/null
@@ -1,30 +0,0 @@
--module(std@bool_test).
--compile(no_auto_import).
-
--export([negate_test/0, compare_test/0, max_test/0, min_test/0, to_int_test/0]).
-
-negate_test() ->
- std@expect:false(std@bool:negate(true)),
- std@expect:true(std@bool:negate(false)).
-
-compare_test() ->
- std@expect:equal(std@bool:compare(true, true), eq),
- std@expect:equal(std@bool:compare(true, false), gt),
- std@expect:equal(std@bool:compare(false, false), eq),
- std@expect:equal(std@bool:compare(false, true), lt).
-
-max_test() ->
- std@expect:equal(std@bool:max(true, true), true),
- std@expect:equal(std@bool:max(true, false), true),
- std@expect:equal(std@bool:max(false, false), false),
- std@expect:equal(std@bool:max(false, true), true).
-
-min_test() ->
- std@expect:equal(std@bool:min(true, true), true),
- std@expect:equal(std@bool:min(true, false), false),
- std@expect:equal(std@bool:min(false, false), false),
- std@expect:equal(std@bool:min(false, true), false).
-
-to_int_test() ->
- std@expect:equal(std@bool:to_int(true), 1),
- std@expect:equal(std@bool:to_int(false), 0).
diff --git a/gen/test/std@float_test.erl b/gen/test/std@float_test.erl
deleted file mode 100644
index 9136643..0000000
--- a/gen/test/std@float_test.erl
+++ /dev/null
@@ -1,42 +0,0 @@
--module(std@float_test).
--compile(no_auto_import).
-
--export([parse_test/0, to_string_test/0, ceiling_test/0, floor_test/0, round_test/0, truncate_test/0]).
-
-parse_test() ->
- std@expect:equal(std@float:parse(<<"1.23">>), {ok, 1.23}),
- std@expect:equal(std@float:parse(<<"5.0">>), {ok, 5.0}),
- std@expect:equal(std@float:parse(<<"0.123456789">>), {ok, 0.123456789}),
- std@expect:is_error(std@float:parse(<<"">>)),
- std@expect:is_error(std@float:parse(<<"what">>)),
- std@expect:is_error(std@float:parse(<<"1">>)).
-
-to_string_test() ->
- std@expect:equal(std@float:to_string(123.0), <<"123.0">>),
- std@expect:equal(std@float:to_string(-8.1), <<"-8.1">>).
-
-ceiling_test() ->
- std@expect:equal(std@float:ceiling(8.1), 9.0),
- std@expect:equal(std@float:ceiling(-8.1), -8.0),
- std@expect:equal(std@float:ceiling(-8.0), -8.0).
-
-floor_test() ->
- std@expect:equal(std@float:floor(8.1), 8.0),
- std@expect:equal(std@float:floor(-8.1), -9.0),
- std@expect:equal(std@float:floor(-8.0), -8.0).
-
-round_test() ->
- std@expect:equal(std@float:round(8.1), 8),
- std@expect:equal(std@float:round(8.4), 8),
- std@expect:equal(std@float:round(8.499), 8),
- std@expect:equal(std@float:round(8.5), 9),
- std@expect:equal(std@float:round(-8.1), -8),
- std@expect:equal(std@float:round(-7.5), -8).
-
-truncate_test() ->
- std@expect:equal(std@float:truncate(8.1), 8),
- std@expect:equal(std@float:truncate(8.4), 8),
- std@expect:equal(std@float:truncate(8.499), 8),
- std@expect:equal(std@float:truncate(8.5), 8),
- std@expect:equal(std@float:truncate(-8.1), -8),
- std@expect:equal(std@float:truncate(-7.5), -7).
diff --git a/gen/test/std@int_test.erl b/gen/test/std@int_test.erl
deleted file mode 100644
index 9aa68f3..0000000
--- a/gen/test/std@int_test.erl
+++ /dev/null
@@ -1,29 +0,0 @@
--module(std@int_test).
--compile(no_auto_import).
-
--export([to_string/0, parse/0, to_base_string/0, compare_test/0]).
-
-to_string() ->
- std@expect:equal(std@int:to_string(123), <<"123">>),
- std@expect:equal(std@int:to_string(-123), <<"-123">>),
- std@expect:equal(std@int:to_string(123), <<"123">>).
-
-parse() ->
- std@expect:equal(std@int:parse(<<"123">>), {ok, 123}),
- std@expect:equal(std@int:parse(<<"-123">>), {ok, -123}),
- std@expect:equal(std@int:parse(<<"0123">>), {ok, 123}),
- std@expect:is_error(std@int:parse(<<"">>)),
- std@expect:is_error(std@int:parse(<<"what">>)),
- std@expect:is_error(std@int:parse(<<"1.23">>)).
-
-to_base_string() ->
- std@expect:equal(std@int:to_base_string(100, 16), <<"64">>),
- std@expect:equal(std@int:to_base_string(-100, 16), <<"-64">>).
-
-compare_test() ->
- std@expect:equal(std@int:compare(0, 0), eq),
- std@expect:equal(std@int:compare(1, 1), eq),
- std@expect:equal(std@int:compare(0, 1), lt),
- std@expect:equal(std@int:compare(-2, -1), lt),
- std@expect:equal(std@int:compare(2, 1), gt),
- std@expect:equal(std@int:compare(-1, -2), gt).
diff --git a/gen/test/std@iodata_test.erl b/gen/test/std@iodata_test.erl
deleted file mode 100644
index cdfe81f..0000000
--- a/gen/test/std@iodata_test.erl
+++ /dev/null
@@ -1,57 +0,0 @@
--module(std@iodata_test).
--compile(no_auto_import).
-
--export([iodata_test/0, lowercase_test/0, uppercase_test/0, split_test/0, is_equal_test/0, is_empty_test/0]).
-
-iodata_test() ->
- Data = std@iodata:prepend(std@iodata:append(std@iodata:append(std@iodata:new(<<"ello">>),
- <<",">>),
- <<" world!">>),
- <<"H">>),
- std@expect:equal(std@iodata:to_string(Data), <<"Hello, world!">>),
- std@expect:equal(std@iodata:byte_size(Data), 13),
- Data1 = std@iodata:prepend_iodata(std@iodata:append_iodata(std@iodata:append_iodata(std@iodata:new(<<"ello">>),
- std@iodata:new(<<",">>)),
- std@iodata:concat([std@iodata:new(<<" wo">>),
- std@iodata:new(<<"rld!">>)])),
- std@iodata:new(<<"H">>)),
- std@expect:equal(std@iodata:to_string(Data1), <<"Hello, world!">>),
- std@expect:equal(std@iodata:byte_size(Data1), 13).
-
-lowercase_test() ->
- std@expect:equal(std@iodata:to_string(std@iodata:lowercase(std@iodata:from_strings([<<"Gleam">>,
- <<"Gleam">>]))),
- <<"gleamgleam">>).
-
-uppercase_test() ->
- std@expect:equal(std@iodata:to_string(std@iodata:uppercase(std@iodata:from_strings([<<"Gleam">>,
- <<"Gleam">>]))),
- <<"GLEAMGLEAM">>).
-
-split_test() ->
- std@expect:equal(std@iodata:split(std@iodata:new(<<"Gleam,Erlang,Elixir">>),
- <<",">>),
- [std@iodata:new(<<"Gleam">>),
- std@iodata:new(<<"Erlang">>),
- std@iodata:new(<<"Elixir">>)]),
- std@expect:equal(std@iodata:split(std@iodata:from_strings([<<"Gleam, Erl">>,
- <<"ang,Elixir">>]),
- <<", ">>),
- [std@iodata:new(<<"Gleam">>),
- std@iodata:from_strings([<<"Erl">>, <<"ang,Elixir">>])]).
-
-is_equal_test() ->
- std@expect:true(std@iodata:is_equal(std@iodata:new(<<"12">>),
- std@iodata:from_strings([<<"1">>,
- <<"2">>]))),
- std@expect:true(std@iodata:is_equal(std@iodata:new(<<"12">>),
- std@iodata:new(<<"12">>))),
- std@expect:false(std@iodata:is_equal(std@iodata:new(<<"12">>),
- std@iodata:new(<<"2">>))).
-
-is_empty_test() ->
- std@expect:true(std@iodata:is_empty(std@iodata:new(<<"">>))),
- std@expect:false(std@iodata:is_empty(std@iodata:new(<<"12">>))),
- std@expect:true(std@iodata:is_empty(std@iodata:from_strings([]))),
- std@expect:true(std@iodata:is_empty(std@iodata:from_strings([<<"">>,
- <<"">>]))).
diff --git a/gen/test/std@list_test.erl b/gen/test/std@list_test.erl
deleted file mode 100644
index d5dc281..0000000
--- a/gen/test/std@list_test.erl
+++ /dev/null
@@ -1,196 +0,0 @@
--module(std@list_test).
--compile(no_auto_import).
-
--export([length_test/0, reverse_test/0, is_empty_test/0, contains_test/0, head_test/0, tail_test/0, filter_test/0, map_test/0, traverse_test/0, drop_test/0, take_test/0, new_test/0, append_test/0, flatten_test/0, fold_test/0, fold_right_test/0, find_test/0, all_test/0, any_test/0, zip_test/0, strict_zip_test/0, intersperse_test/0, at_test/0, unique_test/0, sort_test/0, index_map_test/0, range_test/0, repeat_test/0, split_test/0, split_while_test/0]).
-
-length_test() ->
- std@expect:equal(std@list:length([]), 0),
- std@expect:equal(std@list:length([1]), 1),
- std@expect:equal(std@list:length([1, 1]), 2),
- std@expect:equal(std@list:length([1, 1, 1]), 3).
-
-reverse_test() ->
- std@expect:equal(std@list:reverse([]), []),
- std@expect:equal(std@list:reverse([1, 2, 3, 4, 5]), [5, 4, 3, 2, 1]).
-
-is_empty_test() ->
- std@expect:true(std@list:is_empty([])),
- std@expect:false(std@list:is_empty([1])).
-
-contains_test() ->
- std@expect:true(std@list:contains([0, 4, 5, 1], 1)),
- std@expect:false(std@list:contains([0, 4, 5, 7], 1)),
- std@expect:false(std@list:contains([], 1)).
-
-head_test() ->
- std@expect:equal(std@list:head([0, 4, 5, 7]), {ok, 0}),
- std@expect:is_error(std@list:head([])).
-
-tail_test() ->
- std@expect:equal(std@list:tail([0, 4, 5, 7]), {ok, [4, 5, 7]}),
- std@expect:equal(std@list:tail([0]), {ok, []}),
- std@expect:is_error(std@list:tail([])).
-
-filter_test() ->
- std@expect:equal(std@list:filter([], fun(_) -> true end), []),
- std@expect:equal(std@list:filter([0, 4, 5, 7, 3], fun(_) -> true end),
- [0, 4, 5, 7, 3]),
- std@expect:equal(std@list:filter([0, 4, 5, 7, 3], fun(X) -> X > 4 end),
- [5, 7]),
- std@expect:equal(std@list:filter([0, 4, 5, 7, 3], fun(X) -> X < 4 end),
- [0, 3]).
-
-map_test() ->
- std@expect:equal(std@list:map([], fun(X) -> X * 2 end), []),
- std@expect:equal(std@list:map([0, 4, 5, 7, 3], fun(X) -> X * 2 end),
- [0, 8, 10, 14, 6]).
-
-traverse_test() ->
- Fun = fun(X) -> case X =:= 6 orelse X =:= 5 orelse X =:= 4 of
- true ->
- {ok, X * 2};
-
- false ->
- {error, X}
- end end,
- std@expect:equal(std@list:traverse([5, 6, 5, 6], Fun),
- {ok, [10, 12, 10, 12]}),
- std@expect:equal(std@list:traverse([4, 6, 5, 7, 3], Fun), {error, 7}).
-
-drop_test() ->
- std@expect:equal(std@list:drop([], 5), []),
- std@expect:equal(std@list:drop([1, 2, 3, 4, 5, 6, 7, 8], 5), [6, 7, 8]).
-
-take_test() ->
- std@expect:equal(std@list:take([], 5), []),
- std@expect:equal(std@list:take([1, 2, 3, 4, 5, 6, 7, 8], 5),
- [1, 2, 3, 4, 5]).
-
-new_test() ->
- std@expect:equal(std@list:new(), []).
-
-append_test() ->
- std@expect:equal(std@list:append([1], [2, 3]), [1, 2, 3]).
-
-flatten_test() ->
- std@expect:equal(std@list:flatten([]), []),
- std@expect:equal(std@list:flatten([[]]), []),
- std@expect:equal(std@list:flatten([[], [], []]), []),
- std@expect:equal(std@list:flatten([[1, 2], [], [3, 4]]), [1, 2, 3, 4]).
-
-fold_test() ->
- std@expect:equal(std@list:fold([1, 2, 3], [], fun(X, Acc) -> [X | Acc] end),
- [3, 2, 1]).
-
-fold_right_test() ->
- std@expect:equal(std@list:fold_right([1, 2, 3],
- [],
- fun(X, Acc) -> [X | Acc] end),
- [1, 2, 3]).
-
-find_test() ->
- F = fun(X) -> case X of
- 2 ->
- {ok, 4};
-
- _ ->
- {error, 0}
- end end,
- std@expect:equal(std@list:find([1, 2, 3], F), {ok, 4}),
- std@expect:equal(std@list:find([1, 3, 2], F), {ok, 4}),
- std@expect:is_error(std@list:find([1, 3], F)).
-
-all_test() ->
- std@expect:equal(std@list:all([1, 2, 3, 4, 5], fun(X) -> X > 0 end), true),
- std@expect:equal(std@list:all([1, 2, 3, 4, 5], fun(X) -> X < 0 end), false),
- std@expect:equal(std@list:all([], fun(_) -> false end), true).
-
-any_test() ->
- std@expect:equal(std@list:any([1, 2, 3, 4, 5], fun(X) -> X =:= 2 end),
- true),
- std@expect:equal(std@list:any([1, 2, 3, 4, 5], fun(X) -> X < 0 end), false),
- std@expect:equal(std@list:any([], fun(_) -> false end), false).
-
-zip_test() ->
- std@expect:equal(std@list:zip([], [1, 2, 3]), []),
- std@expect:equal(std@list:zip([1, 2], []), []),
- std@expect:equal(std@list:zip([1, 2, 3], [4, 5, 6]),
- [{1, 4}, {2, 5}, {3, 6}]),
- std@expect:equal(std@list:zip([5, 6], [1, 2, 3]), [{5, 1}, {6, 2}]),
- std@expect:equal(std@list:zip([5, 6, 7], [1, 2]), [{5, 1}, {6, 2}]).
-
-strict_zip_test() ->
- std@expect:is_error(std@list:strict_zip([], [1, 2, 3])),
- std@expect:is_error(std@list:strict_zip([1, 2], [])),
- std@expect:equal(std@list:strict_zip([1, 2, 3], [4, 5, 6]),
- {ok, [{1, 4}, {2, 5}, {3, 6}]}),
- std@expect:is_error(std@list:strict_zip([5, 6], [1, 2, 3])),
- std@expect:is_error(std@list:strict_zip([5, 6, 7], [1, 2])).
-
-intersperse_test() ->
- std@expect:equal(std@list:intersperse([1, 2, 3], 4), [1, 4, 2, 4, 3]),
- std@expect:equal(std@list:intersperse([], 2), []).
-
-at_test() ->
- std@expect:equal(std@list:at([1, 2, 3], 2), {ok, 3}),
- std@expect:is_error(std@list:at([1, 2, 3], 5)),
- std@expect:is_error(std@list:at([], 0)),
- std@expect:is_error(std@list:at([1, 2, 3, 4, 5, 6], -1)).
-
-unique_test() ->
- std@expect:equal(std@list:unique([1, 1, 2, 3, 4, 4, 4, 5, 6]),
- [1, 2, 3, 4, 5, 6]),
- std@expect:equal(std@list:unique([7, 1, 45, 6, 2, 47, 2, 7, 5]),
- [7, 1, 45, 6, 2, 47, 5]),
- std@expect:equal(std@list:unique([3, 4, 5]), [3, 4, 5]),
- std@expect:equal(std@list:unique([]), []).
-
-sort_test() ->
- std@expect:equal(std@list:sort([4, 3, 6, 5, 4]), [3, 4, 4, 5, 6]),
- std@expect:equal(std@list:sort([]), []),
- std@expect:equal(std@list:sort([{1, 2}, {4, 5}, {3, 2}]),
- [{1, 2}, {3, 2}, {4, 5}]).
-
-index_map_test() ->
- std@expect:equal(std@list:index_map([3, 4, 5], fun(I, X) -> {I, X} end),
- [{0, 3}, {1, 4}, {2, 5}]),
- F = fun(I, X) -> std@string:append(X, std@int:to_string(I)) end,
- std@expect:equal(std@list:index_map([<<"a">>, <<"b">>, <<"c">>], F),
- [<<"a0">>, <<"b1">>, <<"c2">>]).
-
-range_test() ->
- std@expect:equal(std@list:range(0, 0), []),
- std@expect:equal(std@list:range(1, 1), []),
- std@expect:equal(std@list:range(-1, -1), []),
- std@expect:equal(std@list:range(0, 1), [0]),
- std@expect:equal(std@list:range(0, 5), [0, 1, 2, 3, 4]),
- std@expect:equal(std@list:range(1, -5), [1, 0, -1, -2, -3, -4]).
-
-repeat_test() ->
- std@expect:equal(std@list:repeat(1, -10), []),
- std@expect:equal(std@list:repeat(1, 0), []),
- std@expect:equal(std@list:repeat(2, 3), [2, 2, 2]),
- std@expect:equal(std@list:repeat(<<"x">>, 5),
- [<<"x">>, <<"x">>, <<"x">>, <<"x">>, <<"x">>]).
-
-split_test() ->
- std@expect:equal(std@list:split([], 0), {[], []}),
- std@expect:equal(std@list:split([0, 1, 2, 3, 4], 0), {[], [0, 1, 2, 3, 4]}),
- std@expect:equal(std@list:split([0, 1, 2, 3, 4], -2),
- {[], [0, 1, 2, 3, 4]}),
- std@expect:equal(std@list:split([0, 1, 2, 3, 4], 1), {[0], [1, 2, 3, 4]}),
- std@expect:equal(std@list:split([0, 1, 2, 3, 4], 3), {[0, 1, 2], [3, 4]}),
- std@expect:equal(std@list:split([0, 1, 2, 3, 4], 9), {[0, 1, 2, 3, 4], []}).
-
-split_while_test() ->
- std@expect:equal(std@list:split_while([], fun(X) -> X =< 5 end), {[], []}),
- std@expect:equal(std@list:split_while([1, 2, 3, 4, 5], fun(X) -> X =< 5 end),
- {[1, 2, 3, 4, 5], []}),
- std@expect:equal(std@list:split_while([1, 2, 3, 4, 5],
- fun(X) -> X =:= 2 end),
- {[], [1, 2, 3, 4, 5]}),
- std@expect:equal(std@list:split_while([1, 2, 3, 4, 5], fun(X) -> X =< 3 end),
- {[1, 2, 3], [4, 5]}),
- std@expect:equal(std@list:split_while([1, 2, 3, 4, 5],
- fun(X) -> X =< -3 end),
- {[], [1, 2, 3, 4, 5]}).
diff --git a/gen/test/std@map_dict_test.erl b/gen/test/std@map_dict_test.erl
deleted file mode 100644
index dc9b85f..0000000
--- a/gen/test/std@map_dict_test.erl
+++ /dev/null
@@ -1,133 +0,0 @@
--module(std@map_dict_test).
--compile(no_auto_import).
-
--export([from_list_test/0, has_key_test/0, new_test/0, fetch_test/0, put_test/0, map_values_test/0, keys_test/0, values_test/0, take_test/0, drop_test/0, merge_test/0, delete_test/0, update_test/0, fold_test/0]).
-
-from_list_test() ->
- std@expect:equal(std@map_dict:size(std@map_dict:from_list([{4, 0}, {1, 0}])),
- 2).
-
-has_key_test() ->
- std@expect:false(std@map_dict:has_key(std@map_dict:from_list([]), 1)),
- std@expect:true(std@map_dict:has_key(std@map_dict:from_list([{1, 0}]), 1)),
- std@expect:true(std@map_dict:has_key(std@map_dict:from_list([{4, 0},
- {1, 0}]),
- 1)),
- std@expect:false(std@map_dict:has_key(std@map_dict:from_list([{4, 0},
- {1, 0}]),
- 0)).
-
-new_test() ->
- std@expect:equal(std@map_dict:size(std@map_dict:new()), 0),
- std@expect:equal(std@map_dict:to_list(std@map_dict:new()), []).
-
-fetch_test() ->
- Proplist = [{4, 0}, {1, 1}],
- M = std@map_dict:from_list(Proplist),
- std@expect:equal(std@map_dict:fetch(M, 4), {ok, 0}),
- std@expect:equal(std@map_dict:fetch(M, 1), {ok, 1}),
- std@expect:is_error(std@map_dict:fetch(M, 2)).
-
-put_test() ->
- std@expect:equal(std@map_dict:put(std@map_dict:put(std@map_dict:put(std@map_dict:new(),
- <<"a">>,
- 0),
- <<"b">>,
- 1),
- <<"c">>,
- 2),
- std@map_dict:from_list([{<<"a">>, 0},
- {<<"b">>, 1},
- {<<"c">>, 2}])).
-
-map_values_test() ->
- std@expect:equal(std@map_dict:map_values(std@map_dict:from_list([{1, 0},
- {2, 1},
- {3, 2}]),
- fun(K, V) -> K + V end),
- std@map_dict:from_list([{1, 1}, {2, 3}, {3, 5}])).
-
-keys_test() ->
- std@expect:equal(std@map_dict:keys(std@map_dict:from_list([{<<"a">>, 0},
- {<<"b">>, 1},
- {<<"c">>, 2}])),
- [<<"a">>, <<"b">>, <<"c">>]).
-
-values_test() ->
- std@expect:equal(std@map_dict:values(std@map_dict:from_list([{<<"a">>, 0},
- {<<"b">>, 1},
- {<<"c">>, 2}])),
- [0, 1, 2]).
-
-take_test() ->
- std@expect:equal(std@map_dict:take(std@map_dict:from_list([{<<"a">>, 0},
- {<<"b">>, 1},
- {<<"c">>, 2}]),
- [<<"a">>, <<"b">>, <<"d">>]),
- std@map_dict:from_list([{<<"a">>, 0}, {<<"b">>, 1}])).
-
-drop_test() ->
- std@expect:equal(std@map_dict:drop(std@map_dict:from_list([{<<"a">>, 0},
- {<<"b">>, 1},
- {<<"c">>, 2}]),
- [<<"a">>, <<"b">>, <<"d">>]),
- std@map_dict:from_list([{<<"c">>, 2}])).
-
-merge_test() ->
- A = std@map_dict:from_list([{<<"a">>, 2}, {<<"c">>, 4}, {<<"d">>, 3}]),
- B = std@map_dict:from_list([{<<"a">>, 0}, {<<"b">>, 1}, {<<"c">>, 2}]),
- std@expect:equal(std@map_dict:merge(A, B),
- std@map_dict:from_list([{<<"a">>, 0},
- {<<"b">>, 1},
- {<<"c">>, 2},
- {<<"d">>, 3}])),
- std@expect:equal(std@map_dict:merge(B, A),
- std@map_dict:from_list([{<<"a">>, 2},
- {<<"b">>, 1},
- {<<"c">>, 4},
- {<<"d">>, 3}])).
-
-delete_test() ->
- std@expect:equal(std@map_dict:delete(std@map_dict:delete(std@map_dict:from_list([{<<"a">>,
- 0},
- {<<"b">>,
- 1},
- {<<"c">>,
- 2}]),
- <<"a">>),
- <<"d">>),
- std@map_dict:from_list([{<<"b">>, 1}, {<<"c">>, 2}])).
-
-update_test() ->
- Dict = std@map_dict:from_list([{<<"a">>, 0}, {<<"b">>, 1}, {<<"c">>, 2}]),
- IncOrZero = fun(X) -> case X of
- {ok, I} ->
- I + 1;
-
- {error, _} ->
- 0
- end end,
- std@expect:equal(std@map_dict:update(Dict, <<"a">>, IncOrZero),
- std@map_dict:from_list([{<<"a">>, 1},
- {<<"b">>, 1},
- {<<"c">>, 2}])),
- std@expect:equal(std@map_dict:update(Dict, <<"b">>, IncOrZero),
- std@map_dict:from_list([{<<"a">>, 0},
- {<<"b">>, 2},
- {<<"c">>, 2}])),
- std@expect:equal(std@map_dict:update(Dict, <<"z">>, IncOrZero),
- std@map_dict:from_list([{<<"a">>, 0},
- {<<"b">>, 1},
- {<<"c">>, 2},
- {<<"z">>, 0}])).
-
-fold_test() ->
- Dict = std@map_dict:from_list([{<<"a">>, 0},
- {<<"b">>, 1},
- {<<"c">>, 2},
- {<<"d">>, 3}]),
- Add = fun(_, V, Acc) -> V + Acc end,
- std@expect:equal(std@map_dict:fold(Dict, 0, Add), 6),
- Concat = fun(K, _, Acc) -> std@string:append(Acc, K) end,
- std@expect:equal(std@map_dict:fold(Dict, <<"">>, Concat), <<"abcd">>),
- std@expect:equal(std@map_dict:fold(std@map_dict:from_list([]), 0, Add), 0).
diff --git a/gen/test/std@order_test.erl b/gen/test/std@order_test.erl
deleted file mode 100644
index f702ff9..0000000
--- a/gen/test/std@order_test.erl
+++ /dev/null
@@ -1,47 +0,0 @@
--module(std@order_test).
--compile(no_auto_import).
-
--export([reverse_test/0, to_int_test/0, compare_test/0, max_test/0, min_test/0]).
-
-reverse_test() ->
- std@expect:equal(std@order:reverse(lt), gt),
- std@expect:equal(std@order:reverse(eq), eq),
- std@expect:equal(std@order:reverse(gt), lt).
-
-to_int_test() ->
- std@expect:equal(std@order:to_int(lt), -1),
- std@expect:equal(std@order:to_int(eq), 0),
- std@expect:equal(std@order:to_int(gt), 1).
-
-compare_test() ->
- std@expect:equal(std@order:compare(lt, lt), eq),
- std@expect:equal(std@order:compare(lt, eq), lt),
- std@expect:equal(std@order:compare(lt, gt), lt),
- std@expect:equal(std@order:compare(eq, lt), gt),
- std@expect:equal(std@order:compare(eq, eq), eq),
- std@expect:equal(std@order:compare(eq, gt), lt),
- std@expect:equal(std@order:compare(gt, lt), gt),
- std@expect:equal(std@order:compare(gt, eq), gt),
- std@expect:equal(std@order:compare(gt, gt), eq).
-
-max_test() ->
- std@expect:equal(std@order:max(lt, lt), lt),
- std@expect:equal(std@order:max(lt, eq), eq),
- std@expect:equal(std@order:max(lt, gt), gt),
- std@expect:equal(std@order:max(eq, lt), eq),
- std@expect:equal(std@order:max(eq, eq), eq),
- std@expect:equal(std@order:max(eq, gt), gt),
- std@expect:equal(std@order:max(gt, lt), gt),
- std@expect:equal(std@order:max(gt, eq), gt),
- std@expect:equal(std@order:max(gt, gt), gt).
-
-min_test() ->
- std@expect:equal(std@order:min(lt, lt), lt),
- std@expect:equal(std@order:min(lt, eq), lt),
- std@expect:equal(std@order:min(lt, gt), lt),
- std@expect:equal(std@order:min(eq, lt), lt),
- std@expect:equal(std@order:min(eq, eq), eq),
- std@expect:equal(std@order:min(eq, gt), eq),
- std@expect:equal(std@order:min(gt, lt), lt),
- std@expect:equal(std@order:min(gt, eq), eq),
- std@expect:equal(std@order:min(gt, gt), gt).
diff --git a/gen/test/std@result_test.erl b/gen/test/std@result_test.erl
deleted file mode 100644
index 941f1ee..0000000
--- a/gen/test/std@result_test.erl
+++ /dev/null
@@ -1,47 +0,0 @@
--module(std@result_test).
--compile(no_auto_import).
-
--export([is_ok_test/0, is_error_test/0, map_test/0, map_error_test/0, flatten_test/0, then_test/0, unwrap_test/0]).
-
-is_ok_test() ->
- std@expect:true(std@result:is_ok({ok, 1})),
- std@expect:false(std@result:is_ok({error, 1})).
-
-is_error_test() ->
- std@expect:false(std@result:is_error({ok, 1})),
- std@expect:true(std@result:is_error({error, 1})).
-
-map_test() ->
- std@expect:equal(std@result:map({ok, 1}, fun(X) -> X + 1 end), {ok, 2}),
- std@expect:equal(std@result:map({ok, 1}, fun(_) -> <<"2">> end),
- {ok, <<"2">>}),
- std@expect:equal(std@result:map({error, 1}, fun(X) -> X + 1 end),
- {error, 1}).
-
-map_error_test() ->
- std@expect:equal(std@result:map_error({ok, 1}, fun(X) -> X + 1 end),
- {ok, 1}),
- std@expect:equal(std@result:map_error({error, 1}, fun(X) -> X + 1 end),
- {error, 2}).
-
-flatten_test() ->
- std@expect:equal(std@result:flatten({ok, {ok, 1}}), {ok, 1}),
- std@expect:equal(std@result:flatten({ok, {error, 1}}), {error, 1}),
- std@expect:equal(std@result:flatten({error, 1}), {error, 1}),
- std@expect:equal(std@result:flatten({error, {error, 1}}),
- {error, {error, 1}}).
-
-then_test() ->
- std@expect:equal(std@result:then({error, 1}, fun(X) -> {ok, X + 1} end),
- {error, 1}),
- std@expect:equal(std@result:then({ok, 1}, fun(X) -> {ok, X + 1} end),
- {ok, 2}),
- std@expect:equal(std@result:then({ok, 1},
- fun(_) -> {ok, <<"type change">>} end),
- {ok, <<"type change">>}),
- std@expect:equal(std@result:then({ok, 1}, fun(_) -> {error, 1} end),
- {error, 1}).
-
-unwrap_test() ->
- std@expect:equal(std@result:unwrap({ok, 1}, 50), 1),
- std@expect:equal(std@result:unwrap({error, <<"nope">>}, 50), 50).
diff --git a/gen/test/std@string_test.erl b/gen/test/std@string_test.erl
deleted file mode 100644
index b0cc46e..0000000
--- a/gen/test/std@string_test.erl
+++ /dev/null
@@ -1,33 +0,0 @@
--module(std@string_test).
--compile(no_auto_import).
-
--export([length_test/0, lowercase_test/0, uppercase_test/0, reverse_test/0, split_test/0, replace_test/0, append_test/0]).
-
-length_test() ->
- std@expect:equal(std@string:length(<<"ß↑e̊">>), 3),
- std@expect:equal(std@string:length(<<"Gleam">>), 5),
- std@expect:equal(std@string:length(<<"">>), 0).
-
-lowercase_test() ->
- std@expect:equal(std@string:lowercase(<<"Gleam">>), <<"gleam">>).
-
-uppercase_test() ->
- std@expect:equal(std@string:uppercase(<<"Gleam">>), <<"GLEAM">>).
-
-reverse_test() ->
- std@expect:equal(std@string:reverse(<<"Gleam">>), <<"maelG">>).
-
-split_test() ->
- std@expect:equal(std@string:split(<<"Gleam,Erlang,Elixir">>, <<",">>),
- [<<"Gleam">>, <<"Erlang">>, <<"Elixir">>]),
- std@expect:equal(std@string:split(<<"Gleam, Erlang,Elixir">>, <<", ">>),
- [<<"Gleam">>, <<"Erlang,Elixir">>]).
-
-replace_test() ->
- std@expect:equal(std@string:replace(<<"Gleam,Erlang,Elixir">>,
- <<",">>,
- <<"++">>),
- <<"Gleam++Erlang++Elixir">>).
-
-append_test() ->
- std@expect:equal(std@string:append(<<"Test">>, <<" Me">>), <<"Test Me">>).
diff --git a/gen/test/std@tuple_test.erl b/gen/test/std@tuple_test.erl
deleted file mode 100644
index a401daf..0000000
--- a/gen/test/std@tuple_test.erl
+++ /dev/null
@@ -1,23 +0,0 @@
--module(std@tuple_test).
--compile(no_auto_import).
-
--export([new_test/0, first_test/0, second_test/0, swap_test/0, fetch_test/0]).
-
-new_test() ->
- std@expect:equal(std@tuple:new(1, 2), {1, 2}),
- std@expect:equal(std@tuple:new(2, <<"3">>), {2, <<"3">>}).
-
-first_test() ->
- std@expect:equal(std@tuple:first({1, 2}), 1).
-
-second_test() ->
- std@expect:equal(std@tuple:second({1, 2}), 2).
-
-swap_test() ->
- std@expect:equal(std@tuple:swap({1, <<"2">>}), {<<"2">>, 1}).
-
-fetch_test() ->
- Proplist = [{0, <<"1">>}, {1, <<"2">>}],
- std@expect:equal(std@tuple:fetch(Proplist, 0), {ok, <<"1">>}),
- std@expect:equal(std@tuple:fetch(Proplist, 1), {ok, <<"2">>}),
- std@expect:is_error(std@tuple:fetch(Proplist, 2)).