mirror of
https://git.postgresql.org/git/postgresql.git
synced 2024-09-28 14:11:48 +02:00
a3d2844852
This commit significantly increases test coverage of geo_ops.c, adding
tests for various issues addressed by 2e2a392de3
(which went undetected
for a long time, at least partially due to not being covered).
This also removes alternative results expecting -0 on some platforms.
Instead the functions are should return the same results everywhere,
transforming -0 to 0 if needed.
The tests are added to geometric.sql file, sorted by the left hand side
of the operators. There are many cross datatype operators, so this seems
like the best solution.
Author: Emre Hasegeli
Reviewed-by: Tomas Vondra
Discussion: https://www.postgresql.org/message-id/CAE2gYzxF7-5djV6-cEvqQu-fNsnt%3DEqbOURx7ZDg%2BVv6ZMTWbg%40mail.gmail.com
25 lines
778 B
SQL
25 lines
778 B
SQL
--
|
|
-- LSEG
|
|
-- Line segments
|
|
--
|
|
|
|
--DROP TABLE LSEG_TBL;
|
|
CREATE TABLE LSEG_TBL (s lseg);
|
|
|
|
INSERT INTO LSEG_TBL VALUES ('[(1,2),(3,4)]');
|
|
INSERT INTO LSEG_TBL VALUES ('(0,0),(6,6)');
|
|
INSERT INTO LSEG_TBL VALUES ('10,-10 ,-3,-4');
|
|
INSERT INTO LSEG_TBL VALUES ('[-1e6,2e2,3e5, -4e1]');
|
|
INSERT INTO LSEG_TBL VALUES (lseg(point(11, 22), point(33,44)));
|
|
INSERT INTO LSEG_TBL VALUES ('[(-10,2),(-10,3)]'); -- vertical
|
|
INSERT INTO LSEG_TBL VALUES ('[(0,-20),(30,-20)]'); -- horizontal
|
|
INSERT INTO LSEG_TBL VALUES ('[(NaN,1),(NaN,90)]'); -- NaN
|
|
|
|
-- bad values for parser testing
|
|
INSERT INTO LSEG_TBL VALUES ('(3asdf,2 ,3,4r2)');
|
|
INSERT INTO LSEG_TBL VALUES ('[1,2,3, 4');
|
|
INSERT INTO LSEG_TBL VALUES ('[(,2),(3,4)]');
|
|
INSERT INTO LSEG_TBL VALUES ('[(1,2),(3,4)');
|
|
|
|
select * from LSEG_TBL;
|