You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Following are the 4 Oracle Types. For the purposes of wtPLSQL Examples, only Object Types will be tested, specifically type methods.
10
+
* Collection of Attributes
11
+
* VArray Collection
12
+
* Nested Table Collection
11
13
* Object
12
14
13
15
## Test a PL/SQL Object Type
14
16
15
-
Create a simple object type to test.
17
+
Create a simple object type to test. This object tracks the minimum value of one or more observations. It also tracks the number of observations. The constructor initializes the object as required.
16
18
17
19
Run this:
18
20
19
21
```
20
22
create or replace type simple_test_obj_type authid definer
21
23
as object
22
-
(l_minimum number
23
-
,l_observations number
24
+
(minimum_value number
25
+
,observations number
24
26
,CONSTRUCTOR FUNCTION simple_test_obj_type
25
27
(SELF IN OUT NOCOPY simple_test_obj_type)
26
28
return self as result
@@ -40,22 +42,144 @@ create or replace type body simple_test_obj_type is
40
42
return self as result
41
43
is
42
44
begin
43
-
l_minimum := null;
44
-
l_observations := 0;
45
+
minimum_value := null;
46
+
observations := 0;
45
47
return;
46
48
end simple_test_obj_type;
47
49
member procedure add_observation
48
50
(SELF IN OUT NOCOPY simple_test_obj_type
49
51
,in_observation number)
50
52
is
51
53
begin
52
-
If l_minimum is null then l_minimum := in_observation;
This is report level 30, the most detailed level of reporting. Starting from the top, we find the test runner executed 1 test case, 2 assertions, and no failed assertions, which resulted in 100% yield (all tests passed). The next section shows the type body tested had 10 lines profiled, 4 were executed, and 4 were not executed, which resulted in a code coverage of 50%. Additional testing is required to achieve 100% code coverage. For brevity, this additional testing will not be included.
182
+
59
183
60
184
## Testing Private Object Methods and Self-Testing
0 commit comments