Skip to content

Commit 8255a75

Browse files
committed
Add regression tests for NULL checks to spherepoly_rad() and spherepoly_deg().
1 parent 95f6217 commit 8255a75

File tree

2 files changed

+8
-0
lines changed

2 files changed

+8
-0
lines changed

expected/poly.out

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -349,6 +349,8 @@ LINE 1: SELECT spoly '{(10d,0d),(10d,1d)}';
349349
^
350350
SELECT spoly(ARRAY[1.0, 2.0, 3.0, 4.0, 5.0]);
351351
ERROR: spherepoly_rad: invalid number of arguments (must be even and >= 6)
352+
SELECT spoly(ARRAY[1.0, 2.0, 3.0, NULL, 5.0, 6.0]);
353+
ERROR: spherepoly_rad: invalid array has null values
352354
SELECT spoly(ARRAY[]::float8[]);
353355
ERROR: spherepoly_rad: invalid number of arguments (must be even and >= 6)
354356
SELECT spoly(NULL::float8[]);
@@ -359,6 +361,8 @@ SELECT spoly(NULL::float8[]);
359361

360362
SELECT spoly_deg(ARRAY[1.0, 2.0, 3.0, 4.0, 5.0]);
361363
ERROR: spherepoly_deg: invalid number of arguments (must be even and >= 6)
364+
SELECT spoly_deg(ARRAY[1.0, 2.0, 3.0, NULL, 5.0, 6.0]);
365+
ERROR: spherepoly_deg: invalid array has null values
362366
SELECT spoly_deg(ARRAY[]::float8[]);
363367
ERROR: spherepoly_deg: invalid number of arguments (must be even and >= 6)
364368
SELECT spoly_deg(NULL::float8[]);

sql/poly.sql

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -92,12 +92,16 @@ SELECT spoly '{(10d,0d),(10d,1d)}';
9292

9393
SELECT spoly(ARRAY[1.0, 2.0, 3.0, 4.0, 5.0]);
9494

95+
SELECT spoly(ARRAY[1.0, 2.0, 3.0, NULL, 5.0, 6.0]);
96+
9597
SELECT spoly(ARRAY[]::float8[]);
9698

9799
SELECT spoly(NULL::float8[]);
98100

99101
SELECT spoly_deg(ARRAY[1.0, 2.0, 3.0, 4.0, 5.0]);
100102

103+
SELECT spoly_deg(ARRAY[1.0, 2.0, 3.0, NULL, 5.0, 6.0]);
104+
101105
SELECT spoly_deg(ARRAY[]::float8[]);
102106

103107
SELECT spoly_deg(NULL::float8[]);

0 commit comments

Comments
 (0)