update emqx_lib_suite and delete duplicate test case

This commit is contained in:
Gilbert Wong 2018-08-29 14:52:35 +08:00
parent 84f241522f
commit 47232d0281
2 changed files with 8 additions and 44 deletions

View File

@ -1,37 +0,0 @@
%% Copyright (c) 2018 EMQ Technologies Co., Ltd. All Rights Reserved.
%%
%% 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(emqx_base62_SUITE).
-include_lib("eunit/include/eunit.hrl").
-define(BASE62, emqx_base62).
-compile(export_all).
-compile(nowarn_export_all).
all() -> [t_base62_encode].
t_base62_encode(_) ->
<<"10">> = ?BASE62:decode(?BASE62:encode(<<"10">>)),
<<"100">> = ?BASE62:decode(?BASE62:encode(<<"100">>)),
<<"9999">> = ?BASE62:decode(?BASE62:encode(<<"9999">>)),
<<"65535">> = ?BASE62:decode(?BASE62:encode(<<"65535">>)),
<<X:128/unsigned-big-integer>> = emqx_guid:gen(),
<<Y:128/unsigned-big-integer>> = emqx_guid:gen(),
X = ?BASE62:decode(?BASE62:encode(X), integer),
Y = ?BASE62:decode(?BASE62:encode(Y), integer),
<<"helloworld">> = ?BASE62:decode(?BASE62:encode("helloworld")),
"helloworld" = ?BASE62:decode(?BASE62:encode("helloworld", string), string).

View File

@ -161,12 +161,13 @@ node_parse_name(_) ->
%%-------------------------------------------------------------------- %%--------------------------------------------------------------------
base62_encode(_) -> base62_encode(_) ->
10 = ?BASE62:decode(?BASE62:encode(10)), <<"10">> = ?BASE62:decode(?BASE62:encode(<<"10">>)),
100 = ?BASE62:decode(?BASE62:encode(100)), <<"100">> = ?BASE62:decode(?BASE62:encode(<<"100">>)),
9999 = ?BASE62:decode(?BASE62:encode(9999)), <<"9999">> = ?BASE62:decode(?BASE62:encode(<<"9999">>)),
65535 = ?BASE62:decode(?BASE62:encode(65535)), <<"65535">> = ?BASE62:decode(?BASE62:encode(<<"65535">>)),
<<X:128/unsigned-big-integer>> = emqx_guid:gen(), <<X:128/unsigned-big-integer>> = emqx_guid:gen(),
<<Y:128/unsigned-big-integer>> = emqx_guid:gen(), <<Y:128/unsigned-big-integer>> = emqx_guid:gen(),
X = ?BASE62:decode(?BASE62:encode(X)), X = ?BASE62:decode(?BASE62:encode(X), integer),
Y = ?BASE62:decode(?BASE62:encode(Y)). Y = ?BASE62:decode(?BASE62:encode(Y), integer),
<<"helloworld">> = ?BASE62:decode(?BASE62:encode("helloworld")),
"helloworld" = ?BASE62:decode(?BASE62:encode("helloworld", string), string).