forked from adrianandrei-ca/pgunit
-
Notifications
You must be signed in to change notification settings - Fork 2
Expand file tree
/
Copy pathmeta.sql
More file actions
148 lines (133 loc) · 2.56 KB
/
meta.sql
File metadata and controls
148 lines (133 loc) · 2.56 KB
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
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
/*
* PGUnit Integrity Test
*/
--@test1 -> true
create function test_case_pgunit_integrity_check_true_is_true ()
returns void
as $$
begin
perform
pgunit.assertTrue (true);
end;
$$
language plpgsql;
--@test2 -> false
create function test_case_pgunit_integrity_check_false_IsNot_True_not_Errnous ()
returns void
as $$
begin
perform
pgunit.assertTrue (false);
end;
$$
language plpgsql;
--@test3 -> erroneous
create function test_case_pgunit_integrity_check_erroneous ()
returns void
as $$
begin
perform
pgunit.assertTrue ('a42');
end;
$$
language plpgsql;
select
*
from
pgunit.run_suite ('pgunit_integrity');
/*
* PGUnit Function overloading
*/
-- @test -> true
create function test_case_pgunit_funover_true_single ()
returns void
as $$
begin
perform
pgunit.assertTrue (true);
end;
$$
language plpgsql;
--todo
-- @test -> true
create function test_case_pgunit_funover_true_msg ()
returns void
as $$
begin
perform
pgunit.assertTrue ('Test msg', true);
end;
$$
language plpgsql;
--@test2 -> false
create function test_case_pgunit_integrity_check_false_IsNot_True_not_Errnous ()
returns void
as $$
begin
raise notice 'PGUnit_Info: Should fail not erroneous';
perform
pgunit.assertTrue (false);
end;
$$
language plpgsql;
--@test3 -> erroneous
create function test_case_pgunit_integrity_check_erroneous ()
returns void
as $$
begin
raise notice 'PGUnit_Info: Should fail erroneous';
perform
pgunit.assertTrue ('a42');
end;
$$
language plpgsql;
select
*
from
pgunit.run_suite ('pgunit_funover');
create or replace function test_setup_client() returns boolean as $$
declare
id int;
begin
select null into id;
return id is null;
end;
$$ language plpgsql;
create or replace function test_precondition_client() returns boolean as $$
declare
ahvnr_t varchar;
ahv_begin_t varchar;
begin
select '756.1111.1111.11' into ahvnr_t from client where id_client = 1001;
select substr(ahvnr_t, 0, 4) into ahv_begin_t;
return ahvnr_t is not null and (ahv_begin_t = '756');
end;
$$ language plpgsql;
create or replace function test_case_client_1() returns void as $$
begin
perform
pgunit.assertFalse (false);
end;
$$
language plpgsql;
create or replace function test_postcondition_client() returns boolean as $$
declare
id int;
begin
select 2 into id;
return id is not null and (id = 2);
end;
$$ language plpgsql;
create or replace function test_teardown_client() returns boolean as $$
declare
id int;
begin
select 2 into id;
return id is not null and (id = 2);
end;
$$ language plpgsql;
select
*
from
pgunit.run_suite ('client');
/*