summaryrefslogtreecommitdiff
path: root/ext/bcmath/tests
Commit message (Collapse)AuthorAgeFilesLines
* Migrate skip checks to --EXTENSIONS--, p1Max Semenik2021-03-2247-135/+95
| | | | | | | | | | | | | For rationale, see https://github.com/php/php-src/pull/6787 Extensions migrated in this part: * bcmath * bz2 * calendar * com_dotnet * ctype Closes GH-6797.
* Add test cases for bcmath ValueErrorsAlex McLean2021-03-0310-0/+232
| | | | | | Closes GH-6714 Signed-off-by: George Peter Banyard <girgias@php.net>
* Fixed bug #80545Jens de Nies2021-01-122-31/+100
| | | | | | | | This converts the remaining "non well-formed" warnings in bcmath to ValueErrors, in line with the other warning promotions that have been performed in this extension. Closes GH-80545.
* Fix memory leak with bcsqrt on number 0<X<1Nikita Popov2020-11-121-0/+2
|
* Update bcmath.scale when calling bcscale()Nikita Popov2020-10-211-0/+8
| | | | | | | | | We should keep the value of bcmath.scale and the internal bc_precision global synchronized. Probably more important than the ability to retrieve bcmath.scale via ini_get(), this also makes sure that the set scale does not leak into the next request, as it currently does.
* Update gmp+bcmath parameter namesNikita Popov2020-09-292-2/+2
| | | | Closes GH-6205.
* Promote some warnings in BCMath to ErrorsGeorge Peter Banyard2020-09-119-32/+51
| | | | | | Also do a bit of refactoring at the same time. Closes GH-6105
* Add many missing closing PHP tags to testsMáté Kocsis2020-08-091-1/+0
| | | | Closes GH-5958
* make bcpowmod stricter by not returning false, instead throw exceptionVladyslav Startsev2020-06-222-3/+25
| | | | Closes GH-5747
* Ensure bcmath scale is between 0 and INT_MAXVladyslav Startsev2020-04-274-8/+91
| | | | | | | | Make sure bcmatch scale is between 0 and INT_MAX, both for the ini setting, and all the functions accepting a scale argument. A ValueError is thrown if a function argument is out of range. Closes GH-5455.
* Make error messages more consistent by fixing capitalizationMáté Kocsis2020-01-174-5/+5
| | | | Closes GH-5066 As a first step, let's capitalize their initial letter when it is applicable.
* Merge branch 'PHP-7.4'Stanislav Malyshev2019-12-161-1/+0
|\ | | | | | | | | * PHP-7.4: Test fixes
| * Test fixesStanislav Malyshev2019-12-161-1/+0
| |
* | Merge branch 'PHP-7.4'Stanislav Malyshev2019-12-161-0/+13
|\ \ | |/ | | | | | | | | | | | | | | | | | | | | | | * PHP-7.4: Fix test Fix bug #78793 Fix build - no model field anymore Fixed bug #78910 Fix #78878: Buffer underflow in bc_shift_addsub Fix test Fix #78862: link() silently truncates after a null byte on Windows Fix #78863: DirectoryIterator class silently truncates after a null byte Fix #78943: mail() may release string with refcount==1 twice
| * Merge branch 'PHP-7.3' into PHP-7.4Stanislav Malyshev2019-12-161-0/+13
| |\ | | | | | | | | | | | | | | | | | | | | | | | | | | | * PHP-7.3: Fixed bug #78910 Fix #78878: Buffer underflow in bc_shift_addsub Fix test Fix #78862: link() silently truncates after a null byte on Windows Fix #78863: DirectoryIterator class silently truncates after a null byte Fix #78943: mail() may release string with refcount==1 twice
| | * Merge branch 'PHP-7.2' into PHP-7.3Stanislav Malyshev2019-12-161-0/+13
| | |\ | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | * PHP-7.2: Fixed bug #78910 Fix #78878: Buffer underflow in bc_shift_addsub Fix test Fix #78862: link() silently truncates after a null byte on Windows Fix #78863: DirectoryIterator class silently truncates after a null byte
| | | * Fix #78878: Buffer underflow in bc_shift_addsubChristoph M. Becker2019-12-161-0/+13
| | | | | | | | | | | | | | | | | | | | We must not rely on `isdigit()` to detect digits, since we only support decimal ASCII digits in the following processing.
| | | * Sync leading and final newlines in *.phpt sectionsPeter Kokot2018-10-1514-14/+14
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | This patch adds missing newlines, trims multiple redundant final newlines into a single one, and trims redundant leading newlines in all *.phpt sections. According to POSIX, a line is a sequence of zero or more non-' <newline>' characters plus a terminating '<newline>' character. [1] Files should normally have at least one final newline character. C89 [2] and later standards [3] mention a final newline: "A source file that is not empty shall end in a new-line character, which shall not be immediately preceded by a backslash character." Although it is not mandatory for all files to have a final newline fixed, a more consistent and homogeneous approach brings less of commit differences issues and a better development experience in certain text editors and IDEs. [1] http://pubs.opengroup.org/onlinepubs/9699919799/basedefs/V1_chap03.html#tag_03_206 [2] https://port70.net/~nsz/c/c89/c89-draft.html#2.1.1.2 [3] https://port70.net/~nsz/c/c99/n1256.html#5.1.1.2
| | | * Merge branch 'PHP-7.1' into PHP-7.2Anatol Belski2018-05-192-10/+5
| | | |\ | | | | | | | | | | | | | | | | | | | | * PHP-7.1: Refix the tests once more
| | | | * Refix the tests once moreAnatol Belski2018-05-192-10/+5
| | | | | | | | | | | | | | | | | | | | | | | | | The behavior change seems to be in both runtime and system. The displaced warning output is of secondary interest anyway.
| | | * | Merge branch 'PHP-7.1' into PHP-7.2Anatol Belski2018-05-194-2/+22
| | | |\ \ | | | | |/ | | | | | | | | | | | | | | | * PHP-7.1: Fix remaining AppVeyor test failures due to the image update
| | | | * Fix remaining AppVeyor test failures due to the image updateAnatol Belski2018-05-194-2/+22
| | | | |
| | * | | Sync leading and final newlines in *.phpt sectionsPeter Kokot2018-10-1514-14/+14
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | This patch adds missing newlines, trims multiple redundant final newlines into a single one, and trims redundant leading newlines in all *.phpt sections. According to POSIX, a line is a sequence of zero or more non-' <newline>' characters plus a terminating '<newline>' character. [1] Files should normally have at least one final newline character. C89 [2] and later standards [3] mention a final newline: "A source file that is not empty shall end in a new-line character, which shall not be immediately preceded by a backslash character." Although it is not mandatory for all files to have a final newline fixed, a more consistent and homogeneous approach brings less of commit differences issues and a better development experience in certain text editors and IDEs. [1] http://pubs.opengroup.org/onlinepubs/9699919799/basedefs/V1_chap03.html#tag_03_206 [2] https://port70.net/~nsz/c/c89/c89-draft.html#2.1.1.2 [3] https://port70.net/~nsz/c/c99/n1256.html#5.1.1.2
* | | | | Clean DONE tags from testsFabien Villepinte2019-11-079-18/+0
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Remove most of the `===DONE===` tags and its variations. Keep `===DONE===` if the test output otherwise becomes empty. Closes GH-4872.
* | | | | Elevate warnings to Error Exceptions in ext/bcmathChristoph M. Becker2019-10-283-9/+21
|/ / / / | | | | | | | | | | | | | | | | | | | | `bcdiv()` and `bcmod()` throw DivisionByZeroError if the divisor is 0, which matches the behavior of the `/` and `%` operators, and `bcsqrt()` throws ValueError for negative operands.
* | | | Warn about non well-formed arguments in bcmathvladyslavstartsev2019-05-143-3/+72
| | | | | | | | | | | | | | | | | | | | Co-Authored-By: Nikita Popov <nikita.ppv@googlemail.com> Co-Authored-By: Christoph M. Becker <cmbecker69@gmx.de>
* | | | Remove tests for zpp failure conditionsNikita Popov2019-03-0510-125/+0
| | | | | | | | | | | | | | | | | | | | These tests only check zpp error conditions, so drop them per zpp testing policy.
* | | | Sync leading and final newlines in *.phpt sectionsPeter Kokot2018-10-1514-14/+14
|/ / / | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | This patch adds missing newlines, trims multiple redundant final newlines into a single one, and trims redundant leading newlines in all *.phpt sections. According to POSIX, a line is a sequence of zero or more non-' <newline>' characters plus a terminating '<newline>' character. [1] Files should normally have at least one final newline character. C89 [2] and later standards [3] mention a final newline: "A source file that is not empty shall end in a new-line character, which shall not be immediately preceded by a backslash character." Although it is not mandatory for all files to have a final newline fixed, a more consistent and homogeneous approach brings less of commit differences issues and a better development experience in certain text editors and IDEs. [1] http://pubs.opengroup.org/onlinepubs/9699919799/basedefs/V1_chap03.html#tag_03_206 [2] https://port70.net/~nsz/c/c89/c89-draft.html#2.1.1.2 [3] https://port70.net/~nsz/c/c99/n1256.html#5.1.1.2
* | | Use EXPECT instead of EXPECTF when possibleGabriel Caruso2018-02-208-8/+8
| | | | | | | | | | | | EXPECTF logic in run-tests.php is considerable, so let's avoid it.
* | | Add test for bcpwmodGabriel Caruso2018-02-121-0/+10
| | | | | | | | | | | | bc_raisemod's mod can't be zero and expo can't be negative
* | | Merge branch 'PHP-7.2'Sara Golemon2017-11-062-4/+4
|\ \ \ | |/ / | | | | | | | | | * PHP-7.2: Scale support for bcmod()
| * | Scale support for bcmod()Christoph M. Becker2017-11-062-4/+4
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | As of commit 90dcbbe (PHP-7.2+) bcmod() supports non-integral parameters as well. Since formerly only integer modulus has been supported, it did not make much sense to cater to the scale with regard to the result. However, now it does for consistency with other BCMath operations. Therefore, we add support for an optional `scale` parameter and fall back to the default scale (`bcmath.scale`) as usual.
* | | Merge branch 'pull-request/2742'Christoph M. Becker2017-09-186-3/+73
|\ \ \ | | | | | | | | | | | | | | | | * pull-request/2742: Fixed bug #66364 (BCMath bcmul ignores scale parameter)
| * | | Fixed bug #66364 (BCMath bcmul ignores scale parameter)Christoph M. Becker2017-09-084-1/+71
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | We change `bcmul()` and `bcpow()` so that the result has exactly the requested scale (i.e. decimal places) to make them consistent with the other BCMath functions. This also changes our stance regarding bug #52748, which had been classified as documentation problem. We do not manipulate the numbers themselves (anymore), but rather introduce `bc_num2str_ex()` which accepts a scale parameter that overrides the scale of the number by omitting extraneous decimals and adding zeros, respectively. This also allows us to get rid of `split_bc_num()`, which fixes bug #75164 as well.
* | | | Merge branch 'pull-request/2745'Christoph M. Becker2017-09-136-49/+36
|\ \ \ \ | | | | | | | | | | | | | | | | | | | | * pull-request/2745: Fixed bug #75169 (BCMath errors/warnings bypass error handling)
| * | | | Fixed bug #75169 (BCMath errors/warnings bypass error handling)Christoph M. Becker2017-09-096-49/+36
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Instead of writing warning messages to `stderr`, we employ PHP's error handling to raise `E_WARNING` even for the single case where `bc_rt_error()` has been called, since that did not actually error out. We choose to call `php_error_docref()` directly in libbcmath, since there is no upstream, and since other PHP core functionality is already used in our bundled libbcmath. Accordingly, we remove `rt.c` so it will not be accidentally used in the future. Besides adapting a few existing tests, we add new tests so that the warnings are tested at least once. We also get rid of the Windows specific tests, since the warning behavior is now supposed to be platform-agnostic.
* | | | | Merge branch 'pull-request/2739'Christoph M. Becker2017-09-131-0/+18
|\ \ \ \ \ | |_|_|/ / |/| | | | | | | | | | | | | | | | | | | | | | | | * pull-request/2739: Fix proto and indentation Fix arginfo Return old scale value from bcscale()
| * | | | Merge branch 'pull-request/778' into bcscale-return-old-valueChristoph M. Becker2017-09-061-0/+18
| |\ \ \ \
| | * | | | Return old scale value from bcscale()Chris Wright2014-08-181-0/+18
| | | | | | | | | | | | | | | | | | | | | | | | Fix for #67855
* | | | | | Merge branch 'PHP-7.1' into PHP-7.2Christoph M. Becker2017-09-111-0/+16
|\ \ \ \ \ \ | |_|_|/ / / |/| | | | / | | |_|_|/ | |/| | | * PHP-7.1: Fixed bug #46781 (BC math handles minus zero incorrectly)
| * | | | Fixed bug #46781 (BC math handles minus zero incorrectly)Christoph M. Becker2017-09-111-0/+16
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Actually, there is no negative zero at all. We obey Postel's law, and still accept negative zeroes, but we store them as positive zeroes after the conversion from string, i.e. we normalize before further processing.
* | | | | Merge branch 'PHP-7.1' into PHP-7.2Christoph M. Becker2017-09-092-0/+24
|\ \ \ \ \ | |/ / / / | | | | | | | | | | | | | | | * PHP-7.1: Fix bug75178.phpt on Windows
| * | | | Fix bug75178.phpt on WindowsChristoph M. Becker2017-09-092-0/+24
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | bug75178.phpt fails on Windows, because the stderr output is not interspersed with stdout output there, but rather is appended to the end. The fix is analogous to bug72093.phpt.
* | | | | Merge branch 'PHP-7.1' into PHP-7.2Christoph M. Becker2017-09-091-0/+18
|\ \ \ \ \ | |/ / / / | | | | / | |_|_|/ |/| | | * PHP-7.1: Fixed bug #75178 (bcpowmod() misbehaves for non-integer base or modulus)
| * | | Fixed bug #75178 (bcpowmod() misbehaves for non-integer base or modulus)Christoph M. Becker2017-09-091-0/+18
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Since `bcpowmod()` does not support non-integral operands, we have to truncate these in addition to emitting a respective warning. We also have to work with the truncated values in the following. We recognize that the division by one to enforce the truncation is actually overkill, but we stick with it for now, and shall tackle the issue for PHP 7.3.
* | | | Merge branch 'PHP-7.1' into PHP-7.2Christoph M. Becker2017-09-071-0/+16
|\ \ \ \ | |/ / / | | | | | | | | | | | | * PHP-7.1: Fixed bug #54598 (bcpowmod() may return 1 if modulus is 1)
| * | | Fixed bug #54598 (bcpowmod() may return 1 if modulus is 1)Christoph M. Becker2017-09-071-0/+16
| | | | | | | | | | | | | | | | | | | | `x mod 1` is always zero; we have to take the scale into account, though.
* | | | Merge branch 'PHP-7.1' into PHP-7.2Christoph M. Becker2017-09-061-0/+16
|\ \ \ \ | |/ / / | | / / | |/ / |/| | * PHP-7.1: Fixed bug #44995 (bcpowmod() fails if scale != 0)
| * | Fixed bug #44995 (bcpowmod() fails if scale != 0)Christoph M. Becker2017-09-061-0/+16
| | | | | | | | | | | | | | | `bc_divmod()` is supposed to do integer division, so we must not apply a scale factor here.
* | | Increased bcmath functions coverage tests using scale option parameterEdgar R. Sandi2017-03-274-0/+8
| | |