-
Notifications
You must be signed in to change notification settings - Fork 189
Expand file tree
/
Copy pathut_results_counter.tpb
More file actions
74 lines (65 loc) · 2.67 KB
/
ut_results_counter.tpb
File metadata and controls
74 lines (65 loc) · 2.67 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
create or replace type body ut_results_counter as
/*
utPLSQL - Version 3
Copyright 2016 - 2026 utPLSQL Project
Licensed under the Apache License, Version 2.0 (the "License"):
you may not use this file except in compliance with the License.
You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.
*/
constructor function ut_results_counter(self in out nocopy ut_results_counter) return self as result is
begin
self.disabled_count := 0;
self.success_count := 0;
self.failure_count := 0;
self.errored_count := 0;
self.warnings_count := 0;
return;
end;
member procedure set_counter_values(self in out nocopy ut_results_counter, a_status integer) is
begin
self.disabled_count := case when a_status = ut_utils.gc_disabled then 1 else 0 end;
self.success_count := case when a_status = ut_utils.gc_success then 1 else 0 end;
self.failure_count := case when a_status = ut_utils.gc_failure then 1 else 0 end;
self.errored_count := case when a_status = ut_utils.gc_error then 1 else 0 end;
end;
member procedure sum_counter_values(self in out nocopy ut_results_counter, a_item ut_results_counter) is
begin
self.disabled_count := self.disabled_count + a_item.disabled_count;
self.success_count := self.success_count + a_item.success_count;
self.failure_count := self.failure_count + a_item.failure_count;
self.errored_count := self.errored_count + a_item.errored_count;
self.warnings_count := self.warnings_count + a_item.warnings_count;
end;
member procedure increase_warning_count(self in out nocopy ut_results_counter, a_count integer := 1) is
begin
self.warnings_count := self.warnings_count + nvl(a_count,0);
end;
member function total_count return integer is
begin
--skip warnings here
return self.disabled_count + self.success_count + self.failure_count + self.errored_count;
end;
member function result_status return integer is
l_result integer;
begin
if self.errored_count > 0 then
l_result := ut_utils.gc_error;
elsif self.failure_count > 0 then
l_result := ut_utils.gc_failure;
elsif self.success_count > 0 then
l_result := ut_utils.gc_success;
elsif self.disabled_count > 0 then
l_result := ut_utils.gc_disabled;
else
l_result := ut_utils.gc_error;
end if;
return l_result;
end;
end;
/