Merge pull request #10 from cloudant/minimum-erlang-otp-19
Change minimum Erlang to OTP 19
diff --git a/.gitignore b/.gitignore
index 7e47c63..9fecffb 100644
--- a/.gitignore
+++ b/.gitignore
@@ -5,3 +5,4 @@
.rebar
priv/*.so
vc*.pdb
+compile_commands.json
diff --git a/.travis.yml b/.travis.yml
index 3a637c2..ad5b569 100644
--- a/.travis.yml
+++ b/.travis.yml
@@ -1,8 +1,9 @@
language: erlang
otp_release:
+ - 21.2
+ - 20.3
- 19.3
- - 18.3
- - 17.5
- - R16B03-1
+script:
+ - make check
diff --git a/rebar.config b/rebar.config
index bb9a1e5..6d77caa 100644
--- a/rebar.config
+++ b/rebar.config
@@ -10,13 +10,3 @@
{"(linux|solaris|darwin|freebsd)", "CFLAGS", "$CFLAGS -Wall -Werror -DNDEBUG -O3"},
{"win32", "CFLAGS", "$CFLAGS /O2 /DNDEBUG /Wall"}
]}.
-
-{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/gen_term.erl b/test/gen_term.erl
index 2937113..08d9f35 100644
--- a/test/gen_term.erl
+++ b/test/gen_term.erl
@@ -42,18 +42,18 @@
gen_integer(_) ->
- Value = case khash_rand:uniform() < 0.5 of
- true -> khash_rand:uniform(127);
- false -> khash_rand:uniform(16#FFFFFFFF)
+ Value = case rand:uniform() < 0.5 of
+ true -> rand:uniform(127);
+ false -> rand:uniform(16#FFFFFFFF)
end,
- case khash_rand:uniform() < 0.5 of
+ case rand:uniform() < 0.5 of
true -> -1 * Value;
false -> Value
end.
gen_float(_) ->
- khash_rand:uniform() * float(16#FFFFFFFF).
+ rand:uniform() * float(16#FFFFFFFF).
gen_reference(_) ->
@@ -62,12 +62,12 @@
gen_port(_) ->
Ports = erlang:ports(),
- lists:nth(khash_rand:uniform(length(Ports)), Ports).
+ lists:nth(rand:uniform(length(Ports)), Ports).
gen_pid(_) ->
Pids = erlang:processes(),
- lists:nth(khash_rand:uniform(length(Pids)), Pids).
+ lists:nth(rand:uniform(length(Pids)), Pids).
gen_tuple(MaxSize) ->
@@ -75,18 +75,18 @@
gen_list(MaxSize) ->
- Width = khash_rand:uniform(MaxSize),
+ Width = rand:uniform(MaxSize),
[any(MaxSize-Width) || _ <- lists:seq(1, Width)].
gen_short_string(_) ->
- Size = khash_rand:uniform(255),
- [khash_rand:uniform(127) || _ <- lists:seq(1, Size)].
+ Size = rand:uniform(255),
+ [rand:uniform(127) || _ <- lists:seq(1, Size)].
gen_string(_) ->
- Size = khash_rand:uniform(4096),
- [khash_rand:uniform(127) || _ <- lists:seq(1, Size)].
+ Size = rand:uniform(4096),
+ [rand:uniform(127) || _ <- lists:seq(1, Size)].
gen_binary(MaxSize) ->
@@ -99,7 +99,7 @@
gen_bignum(_) ->
- 16#FFFFFFFFFFFFFFFF + khash_rand:uniform(16#FFFFFFFF).
+ 16#FFFFFFFFFFFFFFFF + rand:uniform(16#FFFFFFFF).
gen_function(_) ->
@@ -107,7 +107,7 @@
choice(Options) ->
- lists:nth(khash_rand:uniform(length(Options)), Options).
+ lists:nth(rand:uniform(length(Options)), Options).
value_types() ->
diff --git a/test/khash_rand.erl b/test/khash_rand.erl
deleted file mode 100644
index 76b7e38..0000000
--- a/test/khash_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(khash_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/khash_test.erl b/test/khash_test.erl
index 1f116d3..6a23661 100644
--- a/test/khash_test.erl
+++ b/test/khash_test.erl
@@ -1,6 +1,10 @@
-module(khash_test).
--compile([export_all]).
+-export([
+ khash_fetch/0,
+ khash_store/0,
+ run_keys/1
+]).
-include_lib("eunit/include/eunit.hrl").
@@ -366,7 +370,7 @@
weighted_choice(Items0) ->
Items = lists:sort(Items0),
Sum = lists:sum([W || {W, _} <- Items]),
- Choice = khash_rand:uniform() * Sum,
+ Choice = rand:uniform() * Sum,
weighted_choice(Items, 0.0, Choice).
weighted_choice([], _, _) ->
@@ -378,7 +382,7 @@
random_key(D) ->
Keys = lists:usort(dict:fetch_keys(D) ++ [foo]),
- lists:nth(khash_rand:uniform(length(Keys)), Keys).
+ lists:nth(rand:uniform(length(Keys)), Keys).
random_val() ->
gen_term:any().