DCIT / perl-CryptX

https://metacpan.org/pod/CryptX
Other
35 stars 23 forks source link

new t/mbi_ltm_big*.t failures #82

Closed eserte closed 2 years ago

eserte commented 2 years ago

On some of my smokers:

#   Failed test '$x = Math::BigFloat->new("0"); $y = Math::BigFloat->new("10"); $x->bcos($y);'
#   at ./t/mbi_ltm/bigfltpm.inc line 168.
#          got: '1.000000000'
#     expected: '1'

#   Failed test '$x = Math::BigFloat->new("0"); $y = Math::BigFloat->new("20"); $x->bcos($y);'
#   at ./t/mbi_ltm/bigfltpm.inc line 168.
#          got: '1.0000000000000000000'
#     expected: '1'
Argument "" isn't numeric in subtraction (-) at /home/cpansand/.cpan/build/2022051619/Math-BigInt-1.999831-eT1LCZ/blib/lib/Math/BigFloat.pm line 4598, <DATA> line 330.
Argument "" isn't numeric in subtraction (-) at /home/cpansand/.cpan/build/2022051619/Math-BigInt-1.999831-eT1LCZ/blib/lib/Math/BigFloat.pm line 4598, <DATA> line 331.
Argument "" isn't numeric in subtraction (-) at /home/cpansand/.cpan/build/2022051619/Math-BigInt-1.999831-eT1LCZ/blib/lib/Math/BigFloat.pm line 4598, <DATA> line 332.
Argument "abc" isn't numeric in subtraction (-) at /home/cpansand/.cpan/build/2022051619/Math-BigInt-1.999831-eT1LCZ/blib/lib/Math/BigFloat.pm line 4598, <DATA> line 333.
# Looks like you failed 2 tests of 2408.
t/mbi_ltm_bigfltpm.t ................ 
Dubious, test returned 2 (wstat 512, 0x200)
Failed 2/2408 subtests 
    (less 1 skipped subtest: 2405 okay)
...
#   Failed test 'blog(100)'
#   at t/mbi_ltm_biglog.t line 123.
#          got: '100'
#     expected: '2'
# Looks like you failed 1 test of 71.
t/mbi_ltm_biglog.t .................. 
Dubious, test returned 1 (wstat 256, 0x100)
Failed 1/71 subtests 

Maybe caused by a change in the latest Math::BigInt (@pjacklam FYI)

michal-josef-spacek commented 2 years ago

Maybe we could move requires to Math::BigInt with version to test requires.

karel-m commented 2 years ago

Should be fixed in CryptX-0.076_001

abraxxa commented 2 years ago

Please add the fix to the Changes file, thanks!

pjacklam commented 2 years ago

The first failing case,

$x = Math::BigFloat->new("0"); $y = Math::BigFloat->new("10"); $x->bcos($y);

is a bug fix. The output from bcos() was not rounded (by calling round()) when the result was zero. I assume the original author didn't round zero because rounding zero doesn't change the value. However, calling round() also sets the accuracy/precision of the object, which affects how the value is stringified. It also affects later computations involving the value. So for consistency, bcos() always calls round(), explicitly or implicitly. That's why the output is now "1.000000000" rather than just "1".

Ditto for the second failing case, which is identical except that the precision is 20, not 10.

pjacklam commented 2 years ago

The last case,

$x = Math::BigFloat::blog(Math::BigInt->new(100),10)

is worse. While I am encouraging users to switch to method calls rather than function calls, this should still have returned 2, not 100. I need to look further into that. Fortunately, the method call

$x = Math::BigFloat->blog(Math::BigInt->new(100),10)

gives the correct answer.

jkeenan commented 2 years ago

I encountered these test failures today when attempting to install CryptX on FreeBSD-12 against perl-5.36.0 as part of an attempt to diagnose https://github.com/Perl/perl5/issues/19964. Output from make test:

t/mbi_ltm_01load.t .................. ok   
t/mbi_ltm_bigfltpm.t ................ 1/2408 
#   Failed test '$x = Math::BigFloat->new("0"); $y = Math::BigFloat->new("10"); $x->bcos($y);'
#   at ./t/mbi_ltm/bigfltpm.inc line 168.
#          got: '1.000000000'
#     expected: '1'

#   Failed test '$x = Math::BigFloat->new("0"); $y = Math::BigFloat->new("20"); $x->bcos($y);'
#   at ./t/mbi_ltm/bigfltpm.inc line 168.
#          got: '1.0000000000000000000'
#     expected: '1'
t/mbi_ltm_bigfltpm.t ................ 123/2408 Argument "" isn't numeric in subtraction (-) at /home/jkeenan/testing/v5.36.0/lib/perl5/site_perl/5.36.0/Math/BigFloat.pm line 4651, <DATA> line 330.
Argument "" isn't numeric in subtraction (-) at /home/jkeenan/testing/v5.36.0/lib/perl5/site_perl/5.36.0/Math/BigFloat.pm line 4651, <DATA> line 331.
Argument "" isn't numeric in subtraction (-) at /home/jkeenan/testing/v5.36.0/lib/perl5/site_perl/5.36.0/Math/BigFloat.pm line 4651, <DATA> line 332.
Argument "abc" isn't numeric in subtraction (-) at /home/jkeenan/testing/v5.36.0/lib/perl5/site_perl/5.36.0/Math/BigFloat.pm line 4651, <DATA> line 333.
t/mbi_ltm_bigfltpm.t ................ 2329/2408 # Looks like you failed 2 tests of 2408.
t/mbi_ltm_bigfltpm.t ................ Dubious, test returned 2 (wstat 512, 0x200)
Failed 2/2408 subtests 
    (less 1 skipped subtest: 2405 okay)
t/mbi_ltm_bigintg.t ................. ok       
t/mbi_ltm_bigintpm.t ................ ok         
t/mbi_ltm_biglog.t .................. 1/71 
#   Failed test 'blog(100)'
#   at t/mbi_ltm_biglog.t line 123.
#          got: '100'
#     expected: '2'
# Looks like you failed 1 test of 71.
t/mbi_ltm_biglog.t .................. Dubious, test returned 1 (wstat 256, 0x100)
Failed 1/71 subtests 
t/mbi_ltm_bigroot.t ................. ok
...
Test Summary Report
-------------------
t/mbi_ltm_bigfltpm.t              (Wstat: 512 (exited 2) Tests: 2408 Failed: 2)
  Failed tests:  79, 81
  Non-zero exit status: 2
t/mbi_ltm_biglog.t                (Wstat: 256 (exited 1) Tests: 71 Failed: 1)
  Failed test:  41
  Non-zero exit status: 1
Files=135, Tests=24677, 22 wallclock secs ( 1.59 usr  0.25 sys + 18.89 cusr  2.34 csys = 23.08 CPU)
Result: FAIL
Failed 2/135 test programs. 3/24677 subtests failed.
*** Error code 255

Stop.
make: stopped in /usr/home/jkeenan/.cpan/build/CryptX-0.076-0

If the problem has been patched in the repository, do you have an ETA for a new CPAN release?

Thank you very much. Jim Keenan

jkeenan commented 2 years ago

AFAICT, the most recent CPAN production release of CryptX was on Jan 07 2022. So while the issue may be patched on GitHub, we don't yet have a new release for final testing. Do you know when that will be issued?

karel-m commented 2 years ago

... we don't yet have a new release for final testing. Do you know when that will be issued?

CryptX-0.077 released

jkeenan commented 2 years ago

... we don't yet have a new release for final testing. Do you know when that will be issued?

CryptX-0.077 released

All tests now PASS when installed against perl-5.36.0 and against blead. Thanks for your continued maintenance of this codebase.