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:
Peter Eisentraut
2020-06-18 08:41:31 +02:00
parent 2b2a070d98
commit 9d402c73ad
4 changed files with 52 additions and 16 deletions

View File

@ -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);