Movatterモバイル変換


[0]ホーム

URL:


Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

Commit80d0e5b

Browse files
committed
Improve coverage of utils/float.h
check_float4_val() checks after underflow and overflow of valuesconverted from float8 to float4, but there has never been any regressiontests for that. This brings the coverage of float.h to 100%.Author: Movead LiDiscussion:https://postgr.es/m/20190822174636998766188@highgo.ca
1 parentbe182e4 commit80d0e5b

File tree

3 files changed

+21
-0
lines changed

3 files changed

+21
-0
lines changed

‎src/test/regress/expected/float4-misrounded-input.out

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -24,6 +24,14 @@ INSERT INTO FLOAT4_TBL(f1) VALUES ('-10e-70');
2424
ERROR: "-10e-70" is out of range for type real
2525
LINE 1: INSERT INTO FLOAT4_TBL(f1) VALUES ('-10e-70');
2626
^
27+
INSERT INTO FLOAT4_TBL(f1) VALUES ('10e70'::float8);
28+
ERROR: value out of range: overflow
29+
INSERT INTO FLOAT4_TBL(f1) VALUES ('-10e70'::float8);
30+
ERROR: value out of range: overflow
31+
INSERT INTO FLOAT4_TBL(f1) VALUES ('10e-70'::float8);
32+
ERROR: value out of range: underflow
33+
INSERT INTO FLOAT4_TBL(f1) VALUES ('-10e-70'::float8);
34+
ERROR: value out of range: underflow
2735
INSERT INTO FLOAT4_TBL(f1) VALUES ('10e400');
2836
ERROR: "10e400" is out of range for type real
2937
LINE 1: INSERT INTO FLOAT4_TBL(f1) VALUES ('10e400');

‎src/test/regress/expected/float4.out

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -24,6 +24,14 @@ INSERT INTO FLOAT4_TBL(f1) VALUES ('-10e-70');
2424
ERROR: "-10e-70" is out of range for type real
2525
LINE 1: INSERT INTO FLOAT4_TBL(f1) VALUES ('-10e-70');
2626
^
27+
INSERT INTO FLOAT4_TBL(f1) VALUES ('10e70'::float8);
28+
ERROR: value out of range: overflow
29+
INSERT INTO FLOAT4_TBL(f1) VALUES ('-10e70'::float8);
30+
ERROR: value out of range: overflow
31+
INSERT INTO FLOAT4_TBL(f1) VALUES ('10e-70'::float8);
32+
ERROR: value out of range: underflow
33+
INSERT INTO FLOAT4_TBL(f1) VALUES ('-10e-70'::float8);
34+
ERROR: value out of range: underflow
2735
INSERT INTO FLOAT4_TBL(f1) VALUES ('10e400');
2836
ERROR: "10e400" is out of range for type real
2937
LINE 1: INSERT INTO FLOAT4_TBL(f1) VALUES ('10e400');

‎src/test/regress/sql/float4.sql

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -16,6 +16,11 @@ INSERT INTO FLOAT4_TBL(f1) VALUES ('-10e70');
1616
INSERT INTO FLOAT4_TBL(f1)VALUES ('10e-70');
1717
INSERT INTO FLOAT4_TBL(f1)VALUES ('-10e-70');
1818

19+
INSERT INTO FLOAT4_TBL(f1)VALUES ('10e70'::float8);
20+
INSERT INTO FLOAT4_TBL(f1)VALUES ('-10e70'::float8);
21+
INSERT INTO FLOAT4_TBL(f1)VALUES ('10e-70'::float8);
22+
INSERT INTO FLOAT4_TBL(f1)VALUES ('-10e-70'::float8);
23+
1924
INSERT INTO FLOAT4_TBL(f1)VALUES ('10e400');
2025
INSERT INTO FLOAT4_TBL(f1)VALUES ('-10e400');
2126
INSERT INTO FLOAT4_TBL(f1)VALUES ('10e-400');

0 commit comments

Comments
 (0)

[8]ページ先頭

©2009-2025 Movatter.jp