We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
There was an error while loading. Please reload this page.
1 parent 84fdf33 commit 8f9dcbfCopy full SHA for 8f9dcbf
tests/erlang_tests/unique.erl
@@ -20,7 +20,7 @@
20
21
-module(unique).
22
23
--export([start/0]).
+-export([start/0, id/1, check_error/3]).
24
25
start() ->
26
ok = unique_0(),
@@ -39,6 +39,20 @@ start() ->
39
receive_messages(N),
40
0.
41
42
+test_invalid() ->
43
+ ok = ?MODULE:check_error(fun() -> erlang:unique_integer(?MODULE:id(5)) end),
44
+ ok = ?MODULE:check_error(fun() -> erlang:unique_integer(?MODULE:id([positive | monotonic])) end).
45
+
46
+check_error(F, A, B) ->
47
+ try F() of
48
+ Result -> {unexpected, Result}
49
+ catch
50
+ A:B -> ok
51
+ end.
52
53
+id(X) ->
54
+ X.
55
56
unique_0() ->
57
A = erlang:unique_integer(),
58
B = erlang:unique_integer(),
0 commit comments