New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
coreamp.t can fail for rand #13005
Comments
From @nwc10Sending this to perlbug because I don't want it to get lost, and I don't test 303 - &rand at op/coreamp.t line 640 The test code is this: test_proto 'rand'; This is perl 5, version 19, subversion 1 (v5.19.1 (v5.19.0-320-g8ef446e*)) built for x86_64-linux not that I think that that part matters. Nicholas Clark |
From @cpansproutOn Wed May 29 06:18:52 2013, nicholas wrote:
Fixed by fba93b2. -- Father Chrysostomos |
The RT System itself - Status changed from 'new' to 'open' |
@cpansprout - Status changed from 'open' to 'resolved' |
From dabe@dabe.comCreated by dabe@dabe.comWhen building 5.18.1 (using perlbrew) I got the following: # Failed test 303 - &rand at op/coreamp.t line 640 Apparently the random number (0.00006552) happened to be so small -- a one in how many chance, Anyway, I don't know if this is the BEST solution, but here's a quick patch that extends the Inline Patch--- t/op/coreamp.t_OLD 2013-12-10 18:24:46.000000000 -0500
+++ t/op/coreamp.t 2013-12-10 18:29:04.000000000 -0500
@@ -637,7 +637,7 @@
test_proto 'rand';
$tests += 3;
-like &CORE::rand, qr/^0[.\d+-e]*\z/, '&rand';
+like &CORE::rand, qr/^0(?:\.\d+)?\z|[1-9](?:\.\d+)?e-\d+\z/, '&rand';
unlike join(" ", &CORE::rand), qr/ /, '&rand in list context';
&cmp_ok(&CORE::rand(78), qw '< 78', '&rand with 1 arg');
PS: And, looking at it again, the "-" in the "[]" character class isn't at the beginning, prompt% perl -E '$f = "0AQb_`,J"; say "$f: " . ($f =~ qr/^0[.\d+-e]*\z/ ? 'YES' : 'NO')' Perl Info
|
From @jkeenanOn Tue Dec 10 15:58:22 2013, dabe@dabe.com wrote:
cc-ing sprout. Father C. It looks like you've already dealt with issues like this. ##### [perl #118237] Fix coreamp.t’s rand test ##### Could you take a look at this one? Thank you very much. |
The RT System itself - Status changed from 'new' to 'open' |
From @tonycozOn Tue Dec 10 16:12:11 2013, jkeenan wrote:
It's the same bug and is fixed in blead, that line now reads: like &CORE::rand, qr/^[.\d+-e]*\z/, '&rand'; I don't believe this qualifies as a critical issue, and so doesn't qualify for Tony |
From dabe@dabe.comTony Cook via RT wrote:
I wouldn't exactly call that "fixed"... It certainly quells the false negative – i.e., it no longer reports a Now even an empty string will succeed! As will any of the following: -1 I would argue the following is "more correct": like &CORE::rand, qr/^(?:0(?:\.\d+)?|[1-9](?:\.\d+)?e-\d+)\z/, '&rand'; or, (I hope) more readably: like&CORE::rand, qr/^(?: # match either
-- |
From zefram@fysh.orgDabrien 'Dabe' Murphy wrote:
How about a numeric comparison? my $r = &CORE::rand; All this regexp business is entertaining, and I'm not one to shy away -zefram |
From @demerphqOn 13 December 2013 11:45, Zefram <zefram@fysh.org> wrote:
I like this test. But since we all use the same RNG now, cant we just Yves -- |
From dabe@dabe.comTony Cook via RT wrote:
I wouldn't exactly call that "fixed"... It certainly quells the false positive -- i.e., it no longer reports a As it's written now, even an empty string will succeed! As will any of -1 I would argue the following is "more correct": like &CORE::rand, qr/^(?:0(?:\.\d+)?|[1-9](?:\.\d+)?e-\d+)\z/, '&rand'; or, (I hope) more readably: like&CORE::rand, qr/^(?: # match either -- |
From dabe@dabe.comOn 12/13/13, 5:46 AM, Zefram via RT wrote:
You're right, of course... Not that the test code does it, but I wasn't
My only issue there is that, as written, the empty string and How 'bout: my $r = &CORE::rand; ? -- |
From @cpansproutDabrien 'Dabe' Murphy wrote:
That looks good. Could you turn that into a patch? |
From perl5-porters@perl.orgI wrote:
Never mind. I have just applied it as d62c8fd and added you to |
Migrated from rt.perl.org#118237 (status was 'resolved')
Searchable as RT118237$
The text was updated successfully, but these errors were encountered: