aboutsummaryrefslogtreecommitdiffstats
path: root/test/rlx_test_utils.erl
diff options
context:
space:
mode:
authorTristan Sloughter <[email protected]>2016-09-20 11:37:39 -0700
committerGitHub <[email protected]>2016-09-20 11:37:39 -0700
commit7e55cf5720360a166aba8827406e3e1c59e510fd (patch)
treea7585387e74b97a3e5a9d479d0d4031b7a573217 /test/rlx_test_utils.erl
parentc8714a596bd0b7fcec028474eec23938e5fb421c (diff)
parentc81335b3cc0ce22b1f6a6b0d786c5536b9ffb0ed (diff)
downloadrelx-7e55cf5720360a166aba8827406e3e1c59e510fd.tar.gz
relx-7e55cf5720360a166aba8827406e3e1c59e510fd.tar.bz2
relx-7e55cf5720360a166aba8827406e3e1c59e510fd.zip
Merge pull request #506 from lrascao/feature/add_more_otp_versions
Add recent OTP versions
Diffstat (limited to 'test/rlx_test_utils.erl')
-rw-r--r--test/rlx_test_utils.erl19
1 files changed, 13 insertions, 6 deletions
diff --git a/test/rlx_test_utils.erl b/test/rlx_test_utils.erl
index 1157e3f..b26e143 100644
--- a/test/rlx_test_utils.erl
+++ b/test/rlx_test_utils.erl
@@ -45,14 +45,12 @@ get_app_metadata(Name, Vsn, Deps, LibDeps) ->
{applications, Deps}]}.
create_random_name(Name) ->
- random:seed(os:timestamp()),
- Name ++ erlang:integer_to_list(random:uniform(1000000)).
+ Name ++ erlang:integer_to_list(random_uniform(1000000)).
create_random_vsn() ->
- random:seed(os:timestamp()),
- lists:flatten([erlang:integer_to_list(random:uniform(100)),
- ".", erlang:integer_to_list(random:uniform(100)),
- ".", erlang:integer_to_list(random:uniform(100))]).
+ lists:flatten([erlang:integer_to_list(random_uniform(100)),
+ ".", erlang:integer_to_list(random_uniform(100)),
+ ".", erlang:integer_to_list(random_uniform(100))]).
write_config(Filename, Values) ->
ok = filelib:ensure_dir(Filename),
@@ -79,3 +77,12 @@ test_template_contents() ->
"{foo_dir, \"{{foo_dir}}\"}.\n"
"{foo_yahoo, \"{{foo_yahoo}}\"}.\n"
"{google, \"{{google}}\"}.\n".
+
+-ifdef(rand_module).
+random_uniform(N) ->
+ rand:uniform(N).
+-else.
+random_uniform(N) ->
+ random:seed(os:timestamp()),
+ random:uniform(N).
+-endif.