-
-
Notifications
You must be signed in to change notification settings - Fork 369
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
[pgtap] standarizing type_check.pg (#2227)
* [format] 2 space indent on .pg files * [dijkstra] moving old tests around * [dijkstra][pgtap] standarizing type_check.pg * [dijkstra][pgtap] keep other tests * [allpairs][pgtap] moving old tests to edge_cases.pg * [allpairs][pgtap] standarizing type_check.pg * [alphaShape][pgtap] standarizing type_check.pg * [astar][pgtap] moving old test around * [astar][pgtap] standarizing type_check.pg * [bdastar][pgtap] moving old tests to remaining_tests.pg * [bdastar][pgtap] standarizing type_check.pg * [bdastar][pgtap] keep other tests * [bddijkstra][pgtap] moving old tests to remaining_tests.pg * [bddijkstra][pgtap] standarizing type_check.pg * [bddijkstra][pgtap] standarizing type_check.pg * [bellmanford][pgtap] standarizing type_check.pg * [breadthFirstSearch][pgtap] standarizing type_check.pg * [chinese][pgtap] standarizing type_check.pg * [coloring][pgtap] standarizing type_check.pg * [components][pgtap] standarizing type_check.pg * [contraction][pgtap] moving old tests to remaining_tests.pg * [chinese][pgtap] standarizing type_check.pg * [contraction][pgtap] standarizing type_check.pg * [costMatrix][pgtap] standarizing type_check.pg * [costMatrix][pgtap] moving to family and removing duplicate tests * [dag][pgtap] standarizing type_check.pg * [dominator][pgtap] standarizing type_check.pg * [driving_distance][pgtap] standarizing type_check.pg * [DD][pgtap] moving tests to appropiate directory * [ksp][pgtap] standarizing type_check.pg * [linegraph][pgtap] standarizing type_check.pg * [max_flow][pgtap] moving old tests to edge_cases.pg * [max_flow][pgtap] standarizing type_check.pg * [max_flow][pgtap] standarizing type_check.pg * [max_flow][pgtap] standarizing type_check.pg * [max_flow][pgtap] keeping remaining tests as edge_cases.pg * [withPoints][pgtap] standarizing type_check.pg * [mincut][pgtap] standarizing type_check.pg * [spanningtree][pgtap] standarizing type_check.pg * [planar][pgtap] standarizing type_check.pg * [topologicalsort][pgtap] standarizing type_check.pg * [transitiveclosure][pgtap] standarizing type_check.pg * [pickDeliver][pgtap] standarizing type_check.pg * [topology][pgtap] standarizing type_check.pg * [traversal][pgtap] standarizing type_check.pg * [version][pgtap] standarizing type_check.pg * [vrp-basic][pgtap] standarizing type_check.pg * [trsp][pgtap] standarizing type_check.pg * [astar] reducing duplicated code on similar functions * [dijkstra] reducing duplicated code on similar tests * [BFS][pgtap] moving to traversal * [dijkstra] fixing error
- Loading branch information
Showing
131 changed files
with
3,921 additions
and
3,355 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,53 @@ | ||
|
||
BEGIN; | ||
|
||
|
||
UPDATE edge_table SET cost = sign(cost), reverse_cost = sign(reverse_cost); | ||
SELECT plan(4); | ||
|
||
PREPARE q1 AS | ||
SELECT * FROM pgr_floydWarshall( | ||
'SELECT id, source, target, cost, reverse_cost FROM edge_table' | ||
); | ||
|
||
PREPARE q2 AS | ||
SELECT * FROM pgr_floydWarshall( | ||
'SELECT source, target, cost, reverse_cost FROM edge_table' | ||
); | ||
|
||
|
||
PREPARE q3 AS | ||
SELECT * FROM pgr_floydWarshall( | ||
'SELECT source, target, cost FROM edge_table', | ||
true | ||
); | ||
|
||
|
||
SELECT lives_ok('q1', 'SHOULD WORK: without flag & with id'); | ||
SELECT lives_ok('q2', 'SHOULD WORK: without flag'); | ||
SELECT lives_ok('q3', 'SHOULD WORK: with flag'); | ||
|
||
|
||
-- CHECKING THE RETURN TYPES | ||
PREPARE v21q00 AS | ||
SELECT pg_typeof(start_vid)::text AS t1, | ||
pg_typeof(end_vid)::text AS t2, | ||
pg_typeof(agg_cost)::TEXT AS t3 | ||
FROM ( | ||
SELECT * FROM pgr_floydWarshall( | ||
'SELECT id, source, target, cost, reverse_cost FROM edge_table' | ||
)) AS a | ||
LIMIT 1 | ||
; | ||
|
||
PREPARE v21q01 AS | ||
SELECT 'bigint'::text AS t1, | ||
'bigint'::text AS t2, | ||
'double precision'::text AS t3; | ||
|
||
SELECT set_eq('v21q00', 'v21q01','Expected columns names & types'); | ||
|
||
|
||
|
||
SELECT finish(); | ||
ROLLBACK; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,53 +1,22 @@ | ||
|
||
BEGIN; | ||
|
||
SELECT plan(5); | ||
|
||
UPDATE edge_table SET cost = sign(cost), reverse_cost = sign(reverse_cost); | ||
SELECT plan(4); | ||
|
||
PREPARE q1 AS | ||
SELECT * FROM pgr_floydWarshall( | ||
'SELECT id, source, target, cost, reverse_cost FROM edge_table' | ||
); | ||
|
||
PREPARE q2 AS | ||
SELECT * FROM pgr_floydWarshall( | ||
'SELECT source, target, cost, reverse_cost FROM edge_table' | ||
); | ||
|
||
|
||
PREPARE q3 AS | ||
SELECT * FROM pgr_floydWarshall( | ||
'SELECT source, target, cost FROM edge_table', | ||
true | ||
); | ||
|
||
|
||
SELECT lives_ok('q1', 'SHOULD WORK: without flag & with id'); | ||
SELECT lives_ok('q2', 'SHOULD WORK: without flag'); | ||
SELECT lives_ok('q3', 'SHOULD WORK: with flag'); | ||
|
||
|
||
-- CHECKING THE RETURN TYPES | ||
PREPARE v21q00 AS | ||
SELECT pg_typeof(start_vid)::text AS t1, | ||
pg_typeof(end_vid)::text AS t2, | ||
pg_typeof(agg_cost)::TEXT AS t3 | ||
FROM ( | ||
SELECT * FROM pgr_floydWarshall( | ||
'SELECT id, source, target, cost, reverse_cost FROM edge_table' | ||
)) AS a | ||
LIMIT 1 | ||
; | ||
|
||
PREPARE v21q01 AS | ||
SELECT 'bigint'::text AS t1, | ||
'bigint'::text AS t2, | ||
'double precision'::text AS t3; | ||
|
||
SELECT set_eq('v21q00', 'v21q01','Expected columns names & types'); | ||
SELECT has_function('pgr_floydwarshall'); | ||
SELECT has_function('pgr_floydwarshall', ARRAY['text','boolean']); | ||
SELECT function_returns('pgr_floydwarshall', ARRAY['text','boolean'],'setof record'); | ||
|
||
SELECT set_eq( | ||
$$SELECT proargnames from pg_proc where proname = 'pgr_floydwarshall'$$, | ||
$$VALUES | ||
('{"","directed","start_vid","end_vid","agg_cost"}'::TEXT[]) | ||
$$); | ||
|
||
SELECT set_eq( | ||
$$SELECT proallargtypes from pg_proc where proname = 'pgr_floydwarshall'$$, | ||
$$VALUES | ||
('{25,16,20,20,701}'::OID[]) | ||
$$); | ||
|
||
SELECT finish(); | ||
ROLLBACK; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,53 @@ | ||
|
||
BEGIN; | ||
|
||
|
||
UPDATE edge_table SET cost = sign(cost), reverse_cost = sign(reverse_cost); | ||
SELECT plan(4); | ||
|
||
PREPARE q1 AS | ||
SELECT * FROM pgr_johnson( | ||
'SELECT id, source, target, cost, reverse_cost FROM edge_table' | ||
); | ||
|
||
PREPARE q2 AS | ||
SELECT * FROM pgr_johnson( | ||
'SELECT source, target, cost, reverse_cost FROM edge_table' | ||
); | ||
|
||
|
||
PREPARE q3 AS | ||
SELECT * FROM pgr_johnson( | ||
'SELECT source, target, cost FROM edge_table', | ||
true | ||
); | ||
|
||
|
||
SELECT lives_ok('q1', 'SHOULD WORK: without flag & with id'); | ||
SELECT lives_ok('q2', 'SHOULD WORK: without flag'); | ||
SELECT lives_ok('q3', 'SHOULD WORK: with flag'); | ||
|
||
|
||
-- CHECKING THE RETURN TYPES | ||
PREPARE v21q00 AS | ||
SELECT pg_typeof(start_vid)::text AS t1, | ||
pg_typeof(end_vid)::text AS t2, | ||
pg_typeof(agg_cost)::TEXT AS t3 | ||
FROM ( | ||
SELECT * FROM pgr_johnson( | ||
'SELECT id, source, target, cost, reverse_cost FROM edge_table' | ||
)) AS a | ||
LIMIT 1 | ||
; | ||
|
||
PREPARE v21q01 AS | ||
SELECT 'bigint'::text AS t1, | ||
'bigint'::text AS t2, | ||
'double precision'::text AS t3; | ||
|
||
SELECT set_eq('v21q00', 'v21q01','Expected columns names & types'); | ||
|
||
|
||
|
||
SELECT finish(); | ||
ROLLBACK; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,53 +1,22 @@ | ||
|
||
BEGIN; | ||
|
||
SELECT plan(5); | ||
|
||
UPDATE edge_table SET cost = sign(cost), reverse_cost = sign(reverse_cost); | ||
SELECT plan(4); | ||
|
||
PREPARE q1 AS | ||
SELECT * FROM pgr_johnson( | ||
'SELECT id, source, target, cost, reverse_cost FROM edge_table' | ||
); | ||
|
||
PREPARE q2 AS | ||
SELECT * FROM pgr_johnson( | ||
'SELECT source, target, cost, reverse_cost FROM edge_table' | ||
); | ||
|
||
|
||
PREPARE q3 AS | ||
SELECT * FROM pgr_johnson( | ||
'SELECT source, target, cost FROM edge_table', | ||
true | ||
); | ||
|
||
|
||
SELECT lives_ok('q1', 'SHOULD WORK: without flag & with id'); | ||
SELECT lives_ok('q2', 'SHOULD WORK: without flag'); | ||
SELECT lives_ok('q3', 'SHOULD WORK: with flag'); | ||
|
||
|
||
-- CHECKING THE RETURN TYPES | ||
PREPARE v21q00 AS | ||
SELECT pg_typeof(start_vid)::text AS t1, | ||
pg_typeof(end_vid)::text AS t2, | ||
pg_typeof(agg_cost)::TEXT AS t3 | ||
FROM ( | ||
SELECT * FROM pgr_johnson( | ||
'SELECT id, source, target, cost, reverse_cost FROM edge_table' | ||
)) AS a | ||
LIMIT 1 | ||
; | ||
|
||
PREPARE v21q01 AS | ||
SELECT 'bigint'::text AS t1, | ||
'bigint'::text AS t2, | ||
'double precision'::text AS t3; | ||
|
||
SELECT set_eq('v21q00', 'v21q01','Expected columns names & types'); | ||
SELECT has_function('pgr_johnson'); | ||
SELECT has_function('pgr_johnson', ARRAY['text','boolean']); | ||
SELECT function_returns('pgr_johnson', ARRAY['text','boolean'],'setof record'); | ||
|
||
SELECT set_eq( | ||
$$SELECT proargnames from pg_proc where proname = 'pgr_johnson'$$, | ||
$$VALUES | ||
('{"","directed","start_vid","end_vid","agg_cost"}'::TEXT[]) | ||
$$); | ||
|
||
SELECT set_eq( | ||
$$SELECT proallargtypes from pg_proc where proname = 'pgr_johnson'$$, | ||
$$VALUES | ||
('{25,16,20,20,701}'::OID[]) | ||
$$); | ||
|
||
SELECT finish(); | ||
ROLLBACK; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,30 @@ | ||
BEGIN; | ||
|
||
SELECT plan(4); | ||
|
||
SELECT has_function('pgr_alphashape'); | ||
|
||
/* pgtap does not like geometry type, this is a workaround */ | ||
SELECT set_eq( | ||
$$WITH a AS (SELECT unnest(proargtypes) from pg_proc where proname = 'pgr_alphashape') | ||
SELECT typname from a JOIN pg_type ON(oid = unnest)$$, | ||
$$VALUES | ||
('float8'), | ||
('geometry') | ||
$$); | ||
SELECT set_eq( | ||
$$WITH a AS (SELECT prorettype from pg_proc where proname = 'pgr_alphashape') | ||
SELECT typname from a JOIN pg_type ON(oid = prorettype)$$, | ||
$$VALUES | ||
('geometry') | ||
$$); | ||
|
||
SELECT set_eq( | ||
$$SELECT proargnames from pg_proc where proname = 'pgr_alphashape'$$, | ||
$$VALUES | ||
('{"","alpha"}'::TEXT[]) | ||
$$); | ||
|
||
|
||
SELECT finish(); | ||
ROLLBACK; |
File renamed without changes.
File renamed without changes.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,8 @@ | ||
BEGIN; | ||
|
||
SELECT plan(5); | ||
|
||
SELECT astarcostmatrix_types_check('pgr_astarcostmatrix'); | ||
|
||
SELECT finish(); | ||
ROLLBACK; |
Oops, something went wrong.