Commit 80d0e5ba authored by Michael Paquier's avatar Michael Paquier

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
parent be182e4f
......@@ -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');
......
......@@ -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');
......
......@@ -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');
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment