Bugzilla – Attachment 116337 Details for
Bug 27630
TestBuilder real number formatting is different to DBI(x)
Home
|
New
|
Browse
|
Search
|
[?]
|
Reports
|
Help
|
New Account
|
Log In
[x]
|
Forgot Password
Login:
[x]
[patch]
Bug 27630: Allow more TestBuilder decimal places than 2
Bug-27630-Allow-more-TestBuilder-decimal-places-th.patch (text/plain), 1.05 KB, created by
Lari Taskula
on 2021-02-04 19:41:16 UTC
(
hide
)
Description:
Bug 27630: Allow more TestBuilder decimal places than 2
Filename:
MIME Type:
Creator:
Lari Taskula
Created:
2021-02-04 19:41:16 UTC
Size:
1.05 KB
patch
obsolete
>From a1ac9a2e01ffca3fc11b992ba793ba19e4b0d841 Mon Sep 17 00:00:00 2001 >From: Lari Taskula <lari.taskula@hypernova.fi> >Date: Thu, 4 Feb 2021 19:35:43 +0000 >Subject: [PATCH] Bug 27630: Allow more TestBuilder decimal places than 2 > >To test: >1. prove t/db_dependent/TestBuilder.t >2. Observe success > >Sponsored-by: The National Library of Finland >--- > t/lib/TestBuilder.pm | 5 ++++- > 1 file changed, 4 insertions(+), 1 deletion(-) > >diff --git a/t/lib/TestBuilder.pm b/t/lib/TestBuilder.pm >index 26de949fb3..162662433f 100644 >--- a/t/lib/TestBuilder.pm >+++ b/t/lib/TestBuilder.pm >@@ -489,11 +489,14 @@ sub _gen_int { > sub _gen_real { > my ($self, $params) = @_; > my $max = 10 ** 38; >+ my $decimals = 2; > if( defined( $params->{info}->{size} ) ) { > $max = 10 ** ($params->{info}->{size}->[0] - $params->{info}->{size}->[1]); >+ $decimals = $params->{info}->{size}->[1]; > } >+ > $max = 10 ** 5 if $max > 10 ** 5; >- return sprintf("%.2f", rand($max-0.1)); >+ return sprintf('%.'.$decimals.'f', rand($max-0.1)); > } > > sub _gen_date { >-- >2.17.1
You cannot view the attachment while viewing its details because your browser does not support IFRAMEs.
View the attachment on a separate page
.
View Attachment As Diff
View Attachment As Raw
Actions:
View
|
Diff
|
Splinter Review
Attachments on
bug 27630
:
116336
|
116337
|
116340
|
116342
|
116426
|
116427
|
116440
|
116441