more test cases

This commit is contained in:
Feng 2016-02-14 01:50:51 +08:00
parent dfdad8bcb6
commit 9cb0fe3f0a
4 changed files with 20 additions and 9 deletions

View File

@ -35,6 +35,10 @@
-type guid() :: <<_:128>>.
-ifdef(TEST).
-compile(export_all).
-endif.
%% @doc Generate a global unique id.
-spec gen() -> guid().
gen() ->

View File

@ -26,6 +26,10 @@
-export([format/1]).
-ifdef(TEST).
-compile(export_all).
-endif.
%% @doc Protocol name of version
-spec protocol_name(mqtt_vsn()) -> binary().
protocol_name(Ver) when Ver =:= ?MQTT_PROTO_V31; Ver =:= ?MQTT_PROTO_V311 ->

View File

@ -31,6 +31,10 @@
%% Supervisor callbacks
-export([init/1]).
-ifdef(TEST).
-compile(export_all).
-endif.
start_link() ->
supervisor:start_link({local, ?MODULE}, ?MODULE, [emqttd_broker:env(pubsub)]).

View File

@ -25,7 +25,6 @@ gen_test() ->
Guid2 = emqttd_guid:gen(),
?assertMatch(<<_:128>>, Guid1),
?assertEqual(true, Guid2 >= Guid1),
emqttd_guid:ts(r17),
{Ts, _, 0} = Tup = emqttd_guid:new(),
?assertEqual(Ts, emqttd_guid:timestamp(emqttd_guid:bin(Tup))).