From 1d09eac3e7f8ef2ead4c2a7c2bf89db502aab4c5 Mon Sep 17 00:00:00 2001 From: Andy Eschbacher Date: Mon, 19 Sep 2016 16:10:29 -0400 Subject: [PATCH] adding pgsql tests --- src/pg/test/expected/16_getis_test.out | 23 +++++++++++++++++++++++ src/pg/test/sql/16_getis_test.sql | 13 +++++++++++++ 2 files changed, 36 insertions(+) create mode 100644 src/pg/test/expected/16_getis_test.out create mode 100644 src/pg/test/sql/16_getis_test.sql diff --git a/src/pg/test/expected/16_getis_test.out b/src/pg/test/expected/16_getis_test.out new file mode 100644 index 0000000..ba5ee87 --- /dev/null +++ b/src/pg/test/expected/16_getis_test.out @@ -0,0 +1,23 @@ +\pset format unaligned +\set ECHO all +\i test/fixtures/ppoints.sql +SET client_min_messages TO WARNING; +\set ECHO none +_cdb_random_seeds + +(1 row) +z_score|p_value +-1.0358|0.0160 +-0.6404|0.0070 +2.6802|0.0190 +4.7529|0.0020 +2.7270|0.0250 +-1.2444|0.0230 +4.6322|0.0150 +4.5325|0.0220 +-1.3115|0.0090 +-1.3115|0.0080 +4.6361|0.0010 +2.8307|0.0310 +-1.3115|0.0020 +(13 rows) diff --git a/src/pg/test/sql/16_getis_test.sql b/src/pg/test/sql/16_getis_test.sql new file mode 100644 index 0000000..38977a3 --- /dev/null +++ b/src/pg/test/sql/16_getis_test.sql @@ -0,0 +1,13 @@ +\pset format unaligned +\set ECHO all +\i test/fixtures/getis_data.sql + +-- set random seed +SELECT cdb_crankshaft._cdb_random_seeds(1234); + +-- test against PySAL example dataset +SELECT z_score, p_val +FROM cdb_crankshaft.CDB_GetisOrdsG( + 'select * from ppoints2', + 'ratio') As cdb_getisordsg(z_score, p_val, p_z_sim) +WHERE p_val <= 0.05;