mirror of
https://git.postgresql.org/git/postgresql.git
synced 2026-02-26 08:17:01 +08:00
Expand tests for factorial
Move from int4 to numeric test. (They were originally int4 functions, but were reimplemented for numeric in 04a4821adef38155b7920ba9eb83c4c3c29156f8.) Add some tests for edge cases. Discussion: https://www.postgresql.org/message-id/flat/6ce1df0e-86a3-e544-743a-f357ff663f68%402ndquadrant.com
This commit is contained in:
@ -1111,3 +1111,14 @@ FROM (VALUES (0::numeric, 0::numeric),
|
||||
(4232.820::numeric, 132.72000::numeric)) AS v(a, b);
|
||||
|
||||
SELECT lcm(9999 * (10::numeric)^131068 + (10::numeric^131068 - 1), 2); -- overflow
|
||||
|
||||
--
|
||||
-- Tests for factorial
|
||||
--
|
||||
SELECT 4!;
|
||||
SELECT !!3;
|
||||
SELECT factorial(15);
|
||||
SELECT 100000!;
|
||||
SELECT 0!;
|
||||
SELECT -4!;
|
||||
SELECT factorial(-4);
|
||||
|
||||
Reference in New Issue
Block a user