more test cases
This commit is contained in:
parent
dfdad8bcb6
commit
9cb0fe3f0a
|
@ -35,6 +35,10 @@
|
||||||
|
|
||||||
-type guid() :: <<_:128>>.
|
-type guid() :: <<_:128>>.
|
||||||
|
|
||||||
|
-ifdef(TEST).
|
||||||
|
-compile(export_all).
|
||||||
|
-endif.
|
||||||
|
|
||||||
%% @doc Generate a global unique id.
|
%% @doc Generate a global unique id.
|
||||||
-spec gen() -> guid().
|
-spec gen() -> guid().
|
||||||
gen() ->
|
gen() ->
|
||||||
|
|
|
@ -26,6 +26,10 @@
|
||||||
|
|
||||||
-export([format/1]).
|
-export([format/1]).
|
||||||
|
|
||||||
|
-ifdef(TEST).
|
||||||
|
-compile(export_all).
|
||||||
|
-endif.
|
||||||
|
|
||||||
%% @doc Protocol name of version
|
%% @doc Protocol name of version
|
||||||
-spec protocol_name(mqtt_vsn()) -> binary().
|
-spec protocol_name(mqtt_vsn()) -> binary().
|
||||||
protocol_name(Ver) when Ver =:= ?MQTT_PROTO_V31; Ver =:= ?MQTT_PROTO_V311 ->
|
protocol_name(Ver) when Ver =:= ?MQTT_PROTO_V31; Ver =:= ?MQTT_PROTO_V311 ->
|
||||||
|
|
|
@ -31,6 +31,10 @@
|
||||||
%% Supervisor callbacks
|
%% Supervisor callbacks
|
||||||
-export([init/1]).
|
-export([init/1]).
|
||||||
|
|
||||||
|
-ifdef(TEST).
|
||||||
|
-compile(export_all).
|
||||||
|
-endif.
|
||||||
|
|
||||||
start_link() ->
|
start_link() ->
|
||||||
supervisor:start_link({local, ?MODULE}, ?MODULE, [emqttd_broker:env(pubsub)]).
|
supervisor:start_link({local, ?MODULE}, ?MODULE, [emqttd_broker:env(pubsub)]).
|
||||||
|
|
||||||
|
|
|
@ -25,7 +25,6 @@ gen_test() ->
|
||||||
Guid2 = emqttd_guid:gen(),
|
Guid2 = emqttd_guid:gen(),
|
||||||
?assertMatch(<<_:128>>, Guid1),
|
?assertMatch(<<_:128>>, Guid1),
|
||||||
?assertEqual(true, Guid2 >= Guid1),
|
?assertEqual(true, Guid2 >= Guid1),
|
||||||
emqttd_guid:ts(r17),
|
|
||||||
{Ts, _, 0} = Tup = emqttd_guid:new(),
|
{Ts, _, 0} = Tup = emqttd_guid:new(),
|
||||||
?assertEqual(Ts, emqttd_guid:timestamp(emqttd_guid:bin(Tup))).
|
?assertEqual(Ts, emqttd_guid:timestamp(emqttd_guid:bin(Tup))).
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue