Avoid using 64-bit unsigned integers

This commit is contained in:
Evgeny Khramtsov 2019-10-29 13:27:59 +03:00
parent f51ba687e2
commit 86c4f76c51
1 changed files with 9 additions and 6 deletions

View File

@ -77,11 +77,11 @@ send_non_existent(Config) ->
disconnect(Config).
view_non_existent(Config) ->
#stanza_error{reason = 'item-not-found'} = view(Config, [p1_rand:get_string()], false),
#stanza_error{reason = 'item-not-found'} = view(Config, [rand_string()], false),
disconnect(Config).
remove_non_existent(Config) ->
ok = remove(Config, [p1_rand:get_string()]),
ok = remove(Config, [rand_string()]),
disconnect(Config).
view_non_integer(Config) ->
@ -93,7 +93,7 @@ remove_non_integer(Config) ->
disconnect(Config).
malformed_iq(Config) ->
Item = #offline_item{node = p1_rand:get_string()},
Item = #offline_item{node = rand_string()},
Range = [{Type, SubEl} || Type <- [set, get],
SubEl <- [#offline{items = [], _ = false},
#offline{items = [Item], _ = true}]]
@ -112,7 +112,7 @@ malformed_iq(Config) ->
wrong_user(Config) ->
Server = ?config(server, Config),
To = jid:make(<<"foo">>, Server),
Item = #offline_item{node = p1_rand:get_string()},
Item = #offline_item{node = rand_string()},
Range = [{Type, Items, Purge, Fetch} ||
Type <- [set, get],
Items <- [[], [Item]],
@ -130,7 +130,7 @@ wrong_user(Config) ->
disconnect(Config).
unsupported_iq(Config) ->
Item = #offline_item{node = p1_rand:get_string()},
Item = #offline_item{node = rand_string()},
lists:foreach(
fun(Type) ->
#iq{type = error} = Err =
@ -495,7 +495,7 @@ message_iterator(Config) ->
Offline = [[#offline{}]],
Hints = [[#hint{type = T}] || T <- [store, 'no-store']],
XEvent = [[#xevent{id = ID, offline = OfflineFlag}]
|| ID <- [undefined, p1_rand:get_string()],
|| ID <- [undefined, rand_string()],
OfflineFlag <- [false, true]],
Delay = [[#delay{stamp = p1_time_compat:timestamp(), from = ServerJID}]],
AllEls = [Els1 ++ Els2 || Els1 <- [[]] ++ ChatStates ++ Delay ++ Hints ++ Offline,
@ -520,3 +520,6 @@ message_iterator(Config) ->
(#message{type = Type}) -> (Type == chat) or (Type == normal);
(_) -> false
end, All).
rand_string() ->
integer_to_binary(p1_rand:uniform((1 bsl 63)-1)).