Skip to content
Permalink
Browse files
add traffic unit test
  • Loading branch information
DLive committed Apr 24, 2019
1 parent f0ed6de commit 16b84e3adc7403843286b32cecf0c656d7ef707a
Showing 2 changed files with 41 additions and 0 deletions.
@@ -15,3 +15,18 @@ request_gen_test() ->
de_id_count:init([]),
Id = de_id_count:gen_id(),
?assert(is_integer(Id)).

string_join_test()->
Result1 = lists_util:join([<<"a">>,<<"b">>],<<",">>),
?assertEqual(Result1,<<"a,b">>),

Result2 = lists_util:join([],<<",">>),
?assertEqual(Result2,<<"">>),

Result3 = lists_util:join([<<"a">>,"b",ttt],<<",">>),
?assertEqual(Result3,<<"a,b">>),
ok.

list_dup_test()->
R = lists_util:del_duplicate([a,b,a]),
?assertEqual(length(R),2).
@@ -0,0 +1,26 @@
%%%-------------------------------------------------------------------
%%% @author dlive
%%% @copyright (C) 2019, <COMPANY>
%%% @doc
%%%
%%% @end
%%% Created : 25. Apr 2019 12:41 AM
%%%-------------------------------------------------------------------
-module(dubbo_traffic_control_tests).
-author("dlive").

-include_lib("eunit/include/eunit.hrl").

init_test() ->
dubbo_traffic_control:init(),
dubbo_traffic_control:init(),
?assert(true).

goon_test()->
dubbo_traffic_control:init(),
?assertEqual(dubbo_traffic_control:check_goon(key1,2),ok),
?assertEqual(dubbo_traffic_control:check_goon(key1,2),ok),
?assertEqual(dubbo_traffic_control:check_goon(key1,2),full),
?assertEqual(dubbo_traffic_control:check_goon(key1,2),full),
?assertEqual(dubbo_traffic_control:decr_count(key1),ok),
ok.

0 comments on commit 16b84e3

Please sign in to comment.