Merge pull request #7 from cloudant/minimum-erlang-otp-19
Change minimum Erlang to OTP 19
diff --git a/.gitignore b/.gitignore
index 24f9e66..d20aa47 100644
--- a/.gitignore
+++ b/.gitignore
@@ -4,3 +4,4 @@
priv/
.rebar/
vc110.pdb
+compile_commands.json
diff --git a/.travis.yml b/.travis.yml
index e9367c6..54b91fb 100644
--- a/.travis.yml
+++ b/.travis.yml
@@ -16,8 +16,9 @@
language: erlang
otp_release:
- - 18.2
- - 18.1
- - 18.0
- - 17.5
- - R16B03-1
+ - 21.2
+ - 20.3
+ - 19.3
+
+script:
+ - make check
diff --git a/rebar.config b/rebar.config
index a84ea97..ba1d456 100644
--- a/rebar.config
+++ b/rebar.config
@@ -13,14 +13,3 @@
]}.
{eunit_opts, [verbose]}.
-
-{erl_opts, [
- {platform_define, "^R16", 'NORANDMODULE'},
- {platform_define, "^17", 'NORANDMODULE'}
-]}.
-
-{eunit_compile_opts, [
- {platform_define, "^R16", 'NORANDMODULE'},
- {platform_define, "^17", 'NORANDMODULE'}
-]}.
-
diff --git a/test/b64url_rand.erl b/test/b64url_rand.erl
deleted file mode 100644
index a397c3b..0000000
--- a/test/b64url_rand.erl
+++ /dev/null
@@ -1,57 +0,0 @@
-% Licensed under the Apache License, Version 2.0 (the "License"); you may not
-% use this file except in compliance with the License. You may obtain a copy of
-% the License at
-%
-% http://www.apache.org/licenses/LICENSE-2.0
-%
-% Unless required by applicable law or agreed to in writing, software
-% distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
-% WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
-% License for the specific language governing permissions and limitations under
-% the License.
-
--module(b64url_rand).
-
-
--export([
- uniform/0,
- uniform/1
-]).
-
-
--ifdef(NORANDMODULE).
-
-
-uniform() ->
- maybe_set_random_seed(),
- random:uniform().
-
-
-uniform(N) ->
- maybe_set_random_seed(),
- random:uniform(N).
-
-
-maybe_set_random_seed() ->
- case get(random_seed) of
- undefined ->
- {_, Sec, USec} = os:timestamp(),
- Seed = {erlang:phash2(self()), Sec, USec},
- random:seed(Seed);
- _ ->
- ok
- end.
-
-
--else.
-
-
-uniform() ->
- rand:uniform().
-
-
-uniform(N) ->
- rand:uniform(N).
-
-
--endif.
diff --git a/test/b64url_tests.erl b/test/b64url_tests.erl
index c5831ef..27e69db 100644
--- a/test/b64url_tests.erl
+++ b/test/b64url_tests.erl
@@ -65,7 +65,7 @@
gen_binary() ->
% -1 to allow for 0 length
- Length = b64url_rand:uniform(?MAX_SIZE) - 1,
+ Length = rand:uniform(?MAX_SIZE) - 1,
crypto:strong_rand_bytes(Length).
@@ -86,14 +86,14 @@
to_iolist(<<>>) ->
- case b64url_rand:uniform(2) of
+ case rand:uniform(2) of
1 -> <<>>;
2 -> [<<>>]
end;
to_iolist(B) when is_binary(B), size(B) > 0 ->
- S = b64url_rand:uniform(size(B)),
+ S = rand:uniform(size(B)),
<<First:S/binary, Second/binary>> = B,
- case b64url_rand:uniform(3) of
+ case rand:uniform(3) of
1 ->
[to_iolist(First), Second];
2 ->
@@ -104,13 +104,13 @@
insert_error(B) when is_binary(B), size(B) < 2 ->
- case b64url_rand:uniform(2) of
+ case rand:uniform(2) of
1 -> {<<122, 255>>, 0};
2 -> {<<122, 122, 255>>, 0}
end;
insert_error(B) when is_binary(B) ->
B64 = couch_encode_base64url(B),
- S = b64url_rand:uniform(size(B64) - 1),
+ S = rand:uniform(size(B64) - 1),
<<First:S/binary, _:1/binary, Second/binary>> = B64,
{<<First:S/binary, 255, Second/binary>>, 4 * (S div 4)}.
diff --git a/test/benchmark.escript b/test/benchmark.escript
index 75c2341..00a6f0d 100755
--- a/test/benchmark.escript
+++ b/test/benchmark.escript
@@ -115,7 +115,7 @@
do_round_trip(St) ->
- Size = St#st.minsize + b64url_rand:uniform(St#st.maxsize - St#st.minsize),
+ Size = St#st.minsize + rand:uniform(St#st.maxsize - St#st.minsize),
Data = crypto:strong_rand_bytes(Size),
Encoded = (St#st.module):encode(Data),
Data = (St#st.module):decode(Encoded),
@@ -137,7 +137,7 @@
base64:decode(<<Url2/binary, Padding/binary>>).
randomize(List) ->
- List0 = [{b64url_rand:uniform(), L} || L <- List],
+ List0 = [{rand:uniform(), L} || L <- List],
List1 = lists:sort(List0),
[L || {_, L} <- List1].