File: inspection.sql

package info (click to toggle)
h3-pg 4.2.3-3
  • links: PTS, VCS
  • area: main
  • in suites: forky, sid
  • size: 1,196 kB
  • sloc: sql: 4,469; ansic: 3,497; python: 322; sh: 56; makefile: 18
file content (47 lines) | stat: -rw-r--r-- 1,292 bytes parent folder | download | duplicates (3)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
\pset tuples_only on

-- neighbouring indexes (one hexagon, one pentagon) at resolution 3
\set invalid '\'0\''
\set hexagon '\'831c02fffffffff\'::h3index'
\set pentagon '\'831c00fffffffff\'::h3index'
\set resolution 3

--
-- TEST h3_get_resolution
--

SELECT h3_get_resolution(:hexagon) = :resolution AND h3_get_resolution(:pentagon) = :resolution;

--
-- TEST h3_get_base_cell_number
--

-- base cell is same for parents
SELECT h3_get_base_cell_number(:hexagon) = h3_get_base_cell_number(h3_cell_to_parent(:hexagon));
SELECT h3_get_base_cell_number(:pentagon) = h3_get_base_cell_number(h3_cell_to_parent(:pentagon));

--
-- TEST h3_is_valid_cell
--

SELECT h3_is_valid_cell(:hexagon) AND h3_is_valid_cell(:pentagon) AND NOT h3_is_valid_cell(:invalid);

--
-- TEST h3_is_res_class_iii
--

-- if index is Class III then parent is not
SELECT h3_is_res_class_iii(:hexagon) AND NOT h3_is_res_class_iii(h3_cell_to_parent(:hexagon));
SELECT h3_is_res_class_iii(:pentagon) AND NOT h3_is_res_class_iii(h3_cell_to_parent(:pentagon));

--
-- TEST h3_is_pentagon
--

SELECT h3_is_pentagon(:pentagon) AND NOT h3_is_pentagon(:hexagon);

--
-- TEST h3_get_icosahedron_faces
--
SELECT h3_get_icosahedron_faces('851c0047fffffff') = ARRAY[11,6];
SELECT h3_get_icosahedron_faces('851c004bfffffff') = ARRAY[6];