Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Commit 32a59fd

Browse files
authored
Merge pull request #174 from nobu/performance-test-scale
Performance test stability
2 parents 5aab1e6 + fa49e5b commit 32a59fd

File tree

1 file changed

+8
-6
lines changed

1 file changed

+8
-6
lines changed

test/uri/test_mailto.rb

Lines changed: 8 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -213,16 +213,18 @@ def test_check_to
213213
def test_email_regexp
214214
re = URI::MailTo::EMAIL_REGEXP
215215

216-
rate = 1000
216+
repeat = 10
217217
longlabel = '.' + 'invalid'.ljust(63, 'd')
218218
endlabel = ''
219-
pre = ->(n) {'a@invalid' + longlabel*(n*rate) + endlabel}
220-
assert_linear_performance(1..10, pre: pre) do |to|
221-
re =~ to or flunk
219+
seq = (1..3).map {|i| 10**i}
220+
rehearsal = 10
221+
pre = ->(n) {'a@invalid' + longlabel*(n) + endlabel}
222+
assert_linear_performance(seq, rehearsal: rehearsal, pre: pre) do |to|
223+
repeat.times {re =~ to or flunk}
222224
end
223225
endlabel = '.' + 'email'.rjust(64, 'd')
224-
assert_linear_performance(1..10, pre: pre) do |to|
225-
re =~ to and flunk
226+
assert_linear_performance(seq, rehearsal: rehearsal, pre: pre) do |to|
227+
repeat.times {re =~ to and flunk}
226228
end
227229
end
228230

0 commit comments

Comments
 (0)