File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -281,18 +281,26 @@ decode: MMMMMM: invalid input
281281
282282=== TEST 5: random tests
283283--- lua
284- for _ = 1, 1e6 do
285- local size = math.random(1, 20)
286- local buf = table.new(size, 0)
287- for i = 1, size do
288- buf[i] = math.random(33, 126)
284+ local start = ngx.now()
285+ while ture do
286+ for _ = 1, 1000 do
287+ local size = math.random(1, 20)
288+ local buf = table.new(size, 0)
289+ for i = 1, size do
290+ buf[i] = math.random(33, 126)
291+ end
292+
293+ local raw = string.char(unpack(buf))
294+ local encoded = base_encoding.encode_base32(raw)
295+ if base_encoding.decode_base32(encoded) ~= raw then
296+ ngx.say("failed case: ", raw)
297+ return
298+ end
289299 end
290300
291- local raw = string.char(unpack(buf))
292- local encoded = base_encoding.encode_base32(raw)
293- if base_encoding.decode_base32(encoded) ~= raw then
294- ngx.say("failed case: ", raw)
295- return
301+ ngx.update_time()
302+ if ngx.now() - start > 3 then
303+ break
296304 end
297305end
298306ngx.say("ok")
You can’t perform that action at this time.
0 commit comments