-
Notifications
You must be signed in to change notification settings - Fork 2
/
Copy pathbuildings_bulk_load_comparisons_dataset_two.pg
115 lines (88 loc) · 3.49 KB
/
buildings_bulk_load_comparisons_dataset_two.pg
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
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
------------------------------------------------------------------------------
-- Provide unit testing for buildings_bulk_load comparisons functions
-- with two supplied datasets using pgTAP
------------------------------------------------------------------------------
-- Turn off echo.
\set QUIET 1
-- Format the output nicely.
\pset format unaligned
\pset tuples_only true
\pset pager
-- Revert all changes on failure.
\set ON_ERROR_ROLLBACK 1
\set ON_ERROR_STOP true
BEGIN;
SELECT plan(10);
--1----------------------------------------------------------
-- New Buildings contents
SELECT results_eq(
'SELECT buildings_bulk_load.find_added(2)',
$$VALUES (2034)$$,
'Check return of buildings bulk load find_added function'
);
--2----------------------------------------------------------
-- Removed Buildings contents
SELECT results_eq(
'SELECT buildings_bulk_load.find_removed(2)',
$$VALUES (1034)$$,
'Check return of buildings bulk load find_removed function'
);
--3----------------------------------------------------------
-- related
SELECT results_eq(
'SELECT buildings_bulk_load.find_related(2)',
$$VALUES ((1036, 2035)), ((1037, 2035))$$,
'Check return of buildings bulk load finc_related function'
);
--4------------------------------------------------------
-- matched
SELECT results_eq(
'SELECT buildings_bulk_load.find_matched(2)',
$$VALUES ((1035, 2036))$$,
'Check return of buildings bulk load find_matched function'
);
--5----------------------------------------------------------
-- added buildings contents
SELECT set_has(
'SELECT bulk_load_outline_id FROM buildings_bulk_load.added ORDER BY bulk_load_outline_id',
$$VALUES (2034)$$,
'Check contents of added table after building comparison function has run'
);
--6----------------------------------------------------------
-- removed buildings contents
SELECT set_has(
'SELECT building_outline_id, qa_status_id, supplied_dataset_id, removed_id FROM buildings_bulk_load.removed',
$$VALUES (1034, 1, 2, 3)$$,
'Check contents of removed table after building comparison function has run'
);
--7----------------------------------------------------------
-- related bulk_load_outline_id
SELECT set_has(
'SELECT bulk_load_outline_id FROM buildings_bulk_load.related ORDER BY bulk_load_outline_id',
$$VALUES (2035)$$,
'Check bulk load outlines of related table after buildings comparison function has run'
);
--8---------------------------------------------------------
-- related building_outline_id
SELECT set_has(
'SELECT building_outline_id FROM buildings_bulk_load.related ORDER BY building_outline_id',
$$VALUES (1036), (1037)$$,
'Check building_outline_id of related table after buildings comparison function has run'
);
--9------------------------------------------------------
-- Matched bulk_load_outline_id
SELECT set_has(
'SELECT bulk_load_outline_id FROM buildings_bulk_load.matched ORDER BY bulk_load_outline_id',
$$VALUES (2036)$$,
'Check bulk_load_outline_id of matched table after buildings comparison function has run'
);
--10-------------------------------------------------------
-- Matched building_outline_id
SELECT set_has(
'SELECT building_outline_id FROM buildings_bulk_load.matched ORDER BY building_outline_id',
$$VALUES (1035)$$,
'Check building_outline_id outlines of matched table after buildings comparison function has run'
);
--------------------------------------------------------
-- Finish pgTAP testing
SELECT * FROM finish();