mirror of
https://github.com/postgres/postgres.git
synced 2025-05-12 16:21:30 +03:00
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
45 lines
1.0 KiB
SQL
45 lines
1.0 KiB
SQL
--
|
|
-- PATH
|
|
--
|
|
|
|
--DROP TABLE PATH_TBL;
|
|
|
|
CREATE TABLE PATH_TBL (f1 path);
|
|
|
|
INSERT INTO PATH_TBL VALUES ('[(1,2),(3,4)]');
|
|
|
|
INSERT INTO PATH_TBL VALUES (' ( ( 1 , 2 ) , ( 3 , 4 ) ) ');
|
|
|
|
INSERT INTO PATH_TBL VALUES ('[ (0,0),(3,0),(4,5),(1,6) ]');
|
|
|
|
INSERT INTO PATH_TBL VALUES ('((1,2) ,(3,4 ))');
|
|
|
|
INSERT INTO PATH_TBL VALUES ('1,2 ,3,4 ');
|
|
|
|
INSERT INTO PATH_TBL VALUES (' [1,2,3, 4] ');
|
|
|
|
INSERT INTO PATH_TBL VALUES ('((10,20))'); -- Only one point
|
|
|
|
INSERT INTO PATH_TBL VALUES ('[ 11,12,13,14 ]');
|
|
|
|
INSERT INTO PATH_TBL VALUES ('( 11,12,13,14) ');
|
|
|
|
-- bad values for parser testing
|
|
INSERT INTO PATH_TBL VALUES ('[]');
|
|
|
|
INSERT INTO PATH_TBL VALUES ('[(,2),(3,4)]');
|
|
|
|
INSERT INTO PATH_TBL VALUES ('[(1,2),(3,4)');
|
|
|
|
INSERT INTO PATH_TBL VALUES ('(1,2,3,4');
|
|
|
|
INSERT INTO PATH_TBL VALUES ('(1,2),(3,4)]');
|
|
|
|
SELECT '' AS count, f1 AS open_path FROM PATH_TBL WHERE isopen(f1);
|
|
|
|
SELECT '' AS count, f1 AS closed_path FROM PATH_TBL WHERE isclosed(f1);
|
|
|
|
SELECT '' AS count, pclose(f1) AS closed_path FROM PATH_TBL;
|
|
|
|
SELECT '' AS count, popen(f1) AS open_path FROM PATH_TBL;
|