Skip to content

Commit

Permalink
add tests in RS
Browse files Browse the repository at this point in the history
  • Loading branch information
vdelacruzb committed Jan 11, 2024
1 parent 3b91a05 commit dc870cc
Showing 1 changed file with 22 additions and 4 deletions.
26 changes: 22 additions & 4 deletions clouds/redshift/modules/test/quadbin/test_QUADBIN_FROMLONGLAT.py
Original file line number Diff line number Diff line change
Expand Up @@ -4,10 +4,28 @@


def test_quadbin_fromlonglat():
result = run_query('SELECT @@RS_SCHEMA@@.QUADBIN_FROMLONGLAT(40.4168, -3.7038, 4)')

assert len(result[0]) == 1
assert result[0][0] == 5209574053332910079
result = run_query(
"""
WITH inputs AS (
SELECT 1 AS ID, @@RS_SCHEMA@@.QUADBIN_FROMLONGLAT(40.4168, -3.7038, 4)
UNION ALL SELECT 2,
@@RS_SCHEMA@@.QUADBIN_FROMLONGLAT(0, 85.05112877980659, 26)
UNION ALL SELECT 3, @@RS_SCHEMA@@.QUADBIN_FROMLONGLAT(0, 88, 26)
UNION ALL SELECT 4, @@RS_SCHEMA@@.QUADBIN_FROMLONGLAT(0, 90, 26)
UNION ALL SELECT 5,
@@RS_SCHEMA@@.QUADBIN_FROMLONGLAT(0, -85.05112877980659, 26)
UNION ALL SELECT 6, @@RS_SCHEMA@@.QUADBIN_FROMLONGLAT(0, -88, 26)
UNION ALL SELECT 7, @@RS_SCHEMA@@.QUADBIN_FROMLONGLAT(0, -90, 26)
)
SELECT * FROM inputs ORDER BY id ASC"""
)
assert result[0][1] == 5209574053332910079
assert result[1][1] == 5306366260949286912
assert result[2][1] == 5306366260949286912
assert result[3][1] == 5306366260949286912
assert result[4][1] == 5309368660700867242
assert result[5][1] == 5309368660700867242
assert result[6][1] == 5309368660700867242


def test_quadbin_fromlonglat_null():
Expand Down

0 comments on commit dc870cc

Please sign in to comment.