1
0
mirror of https://github.com/postgres/postgres.git synced 2025-06-25 01:02:05 +03:00

Improve coverage of utils/float.h

check_float4_val() checks after underflow and overflow of values
converted from float8 to float4, but there has never been any regression
tests for that.  This brings the coverage of float.h to 100%.

Author: Movead Li
Discussion: https://postgr.es/m/20190822174636998766188@highgo.ca
This commit is contained in:
Michael Paquier
2019-08-28 12:28:16 +09:00
parent be182e4f9e
commit 80d0e5ba3f
3 changed files with 21 additions and 0 deletions

View File

@ -24,6 +24,14 @@ INSERT INTO FLOAT4_TBL(f1) VALUES ('-10e-70');
ERROR: "-10e-70" is out of range for type real
LINE 1: INSERT INTO FLOAT4_TBL(f1) VALUES ('-10e-70');
^
INSERT INTO FLOAT4_TBL(f1) VALUES ('10e70'::float8);
ERROR: value out of range: overflow
INSERT INTO FLOAT4_TBL(f1) VALUES ('-10e70'::float8);
ERROR: value out of range: overflow
INSERT INTO FLOAT4_TBL(f1) VALUES ('10e-70'::float8);
ERROR: value out of range: underflow
INSERT INTO FLOAT4_TBL(f1) VALUES ('-10e-70'::float8);
ERROR: value out of range: underflow
INSERT INTO FLOAT4_TBL(f1) VALUES ('10e400');
ERROR: "10e400" is out of range for type real
LINE 1: INSERT INTO FLOAT4_TBL(f1) VALUES ('10e400');

View File

@ -24,6 +24,14 @@ INSERT INTO FLOAT4_TBL(f1) VALUES ('-10e-70');
ERROR: "-10e-70" is out of range for type real
LINE 1: INSERT INTO FLOAT4_TBL(f1) VALUES ('-10e-70');
^
INSERT INTO FLOAT4_TBL(f1) VALUES ('10e70'::float8);
ERROR: value out of range: overflow
INSERT INTO FLOAT4_TBL(f1) VALUES ('-10e70'::float8);
ERROR: value out of range: overflow
INSERT INTO FLOAT4_TBL(f1) VALUES ('10e-70'::float8);
ERROR: value out of range: underflow
INSERT INTO FLOAT4_TBL(f1) VALUES ('-10e-70'::float8);
ERROR: value out of range: underflow
INSERT INTO FLOAT4_TBL(f1) VALUES ('10e400');
ERROR: "10e400" is out of range for type real
LINE 1: INSERT INTO FLOAT4_TBL(f1) VALUES ('10e400');

View File

@ -16,6 +16,11 @@ INSERT INTO FLOAT4_TBL(f1) VALUES ('-10e70');
INSERT INTO FLOAT4_TBL(f1) VALUES ('10e-70');
INSERT INTO FLOAT4_TBL(f1) VALUES ('-10e-70');
INSERT INTO FLOAT4_TBL(f1) VALUES ('10e70'::float8);
INSERT INTO FLOAT4_TBL(f1) VALUES ('-10e70'::float8);
INSERT INTO FLOAT4_TBL(f1) VALUES ('10e-70'::float8);
INSERT INTO FLOAT4_TBL(f1) VALUES ('-10e-70'::float8);
INSERT INTO FLOAT4_TBL(f1) VALUES ('10e400');
INSERT INTO FLOAT4_TBL(f1) VALUES ('-10e400');
INSERT INTO FLOAT4_TBL(f1) VALUES ('10e-400');