Skip to content

Commit a2b01bd

Browse files
authored
Merge pull request #459 from wifiBlack/week-4-king-minimum-ordering-try2
Week 4 king and minimumdegree ordering try2
2 parents 64afafc + 3e2564e commit a2b01bd

File tree

6 files changed

+118
-4
lines changed

6 files changed

+118
-4
lines changed
Lines changed: 57 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,57 @@
1+
2+
/*PGR-GNU*****************************************************************
3+
4+
Copyright (c) 2018 pgRouting developers
5+
6+
7+
------
8+
This program is free software; you can redistribute it and/or modify
9+
it under the terms of the GNU General Public License as published by
10+
the Free Software Foundation; either version 2 of the License, or
11+
(at your option) any later version.
12+
This program is distributed in the hope that it will be useful,
13+
but WITHOUT ANY WARRANTY; without even the implied warranty of
14+
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
15+
GNU General Public License for more details.
16+
You should have received a copy of the GNU General Public License
17+
along with this program; if not, write to the Free Software
18+
Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
19+
********************************************************************PGR-GNU*/
20+
BEGIN;
21+
22+
SELECT CASE WHEN min_version('4.0.0') THEN plan(5) ELSE plan(1) END;
23+
24+
CREATE OR REPLACE FUNCTION types_check()
25+
RETURNS SETOF TEXT AS
26+
$BODY$
27+
BEGIN
28+
29+
IF NOT min_version('4.0.0') THEN
30+
RETURN QUERY
31+
SELECT skip(1, 'pgr_kingOrdering: Function is new on 4.0.0');
32+
RETURN;
33+
END IF;
34+
35+
RETURN QUERY SELECT has_function('pgr_kingordering');
36+
RETURN QUERY SELECT has_function('pgr_kingordering', ARRAY['text']);
37+
RETURN QUERY SELECT function_returns('pgr_kingordering', ARRAY['text'], 'setof record');
38+
39+
RETURN QUERY
40+
SELECT function_args_eq('pgr_kingordering',
41+
$$SELECT '{"","seq","node"}'::TEXT[] $$
42+
);
43+
44+
RETURN QUERY
45+
SELECT function_types_eq('pgr_kingordering',
46+
$$VALUES
47+
('{text,int8,int8}'::TEXT[])
48+
$$
49+
);
50+
END;
51+
$BODY$
52+
LANGUAGE plpgsql;
53+
54+
SELECT types_check();
55+
56+
SELECT * FROM finish();
57+
ROLLBACK;
Lines changed: 57 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,57 @@
1+
2+
/*PGR-GNU*****************************************************************
3+
4+
Copyright (c) 2018 pgRouting developers
5+
6+
7+
------
8+
This program is free software; you can redistribute it and/or modify
9+
it under the terms of the GNU General Public License as published by
10+
the Free Software Foundation; either version 2 of the License, or
11+
(at your option) any later version.
12+
This program is distributed in the hope that it will be useful,
13+
but WITHOUT ANY WARRANTY; without even the implied warranty of
14+
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
15+
GNU General Public License for more details.
16+
You should have received a copy of the GNU General Public License
17+
along with this program; if not, write to the Free Software
18+
Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
19+
********************************************************************PGR-GNU*/
20+
BEGIN;
21+
22+
SELECT CASE WHEN min_version('4.0.0') THEN plan(5) ELSE plan(1) END;
23+
24+
CREATE OR REPLACE FUNCTION types_check()
25+
RETURNS SETOF TEXT AS
26+
$BODY$
27+
BEGIN
28+
29+
IF NOT min_version('4.0.0') THEN
30+
RETURN QUERY
31+
SELECT skip(1, 'pgr_minDegreeOrdering: Function is new on 4.0.0');
32+
RETURN;
33+
END IF;
34+
35+
RETURN QUERY SELECT has_function('pgr_mindegreeordering');
36+
RETURN QUERY SELECT has_function('pgr_mindegreeordering', ARRAY['text']);
37+
RETURN QUERY SELECT function_returns('pgr_mindegreeordering', ARRAY['text'], 'setof record');
38+
39+
RETURN QUERY
40+
SELECT function_args_eq('pgr_mindegreeordering',
41+
$$SELECT '{"","seq","node"}'::TEXT[] $$
42+
);
43+
44+
RETURN QUERY
45+
SELECT function_types_eq('pgr_mindegreeordering',
46+
$$VALUES
47+
('{text,int8,int8}'::TEXT[])
48+
$$
49+
);
50+
END;
51+
$BODY$
52+
LANGUAGE plpgsql;
53+
54+
SELECT types_check();
55+
56+
SELECT * FROM finish();
57+
ROLLBACK;

sql/ordering/_kingOrdering.sql

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -31,7 +31,7 @@ Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
3131
-- _pgr_kingOrdering
3232
----------------------------
3333

34-
--v3.4.0
34+
--v4.0
3535
CREATE FUNCTION _pgr_kingOrdering(
3636
TEXT,
3737
OUT seq BIGINT,

sql/ordering/_minDegreeOrdering.sql

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -31,7 +31,7 @@ Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
3131
-- _pgr_minDegreeOrdering
3232
----------------------------
3333

34-
--v3.4.0
34+
--v4.0.0
3535
CREATE FUNCTION _pgr_minDegreeOrdering(
3636
TEXT,
3737
OUT seq BIGINT,

sql/ordering/kingOrdering.sql

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -31,7 +31,7 @@ Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
3131
-- pgr_kingOrdering
3232
----------------------------
3333

34-
--v3.4.0
34+
--v4.0.0
3535
CREATE FUNCTION pgr_kingOrdering(
3636
TEXT, -- edges_sql (required)
3737
OUT seq BIGINT,

sql/ordering/minDegreeOrdering.sql

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -31,7 +31,7 @@ Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
3131
-- pgr_minDegreeOrdering
3232
----------------------------
3333

34-
--v3.4.0
34+
--v4.0.0
3535
CREATE FUNCTION pgr_minDegreeOrdering(
3636
TEXT, -- edges_sql (required)
3737
OUT seq BIGINT,

0 commit comments

Comments
 (0)