-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathType-Test.sql
More file actions
73 lines (67 loc) · 2.03 KB
/
Copy pathType-Test.sql
File metadata and controls
73 lines (67 loc) · 2.03 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
create or replace type simple_test_obj_type authid definer
as object
(minimum_value number
,observations number
,CONSTRUCTOR FUNCTION simple_test_obj_type
(SELF IN OUT NOCOPY simple_test_obj_type)
return self as result
,member procedure add_observation
(SELF IN OUT NOCOPY simple_test_obj_type
,in_observation number)
);
/
create or replace type body simple_test_obj_type is
CONSTRUCTOR FUNCTION simple_test_obj_type
(SELF IN OUT NOCOPY simple_test_obj_type)
return self as result
is
begin
minimum_value := null;
observations := 0;
return;
end simple_test_obj_type;
member procedure add_observation
(SELF IN OUT NOCOPY simple_test_obj_type
,in_observation number)
is
begin
If minimum_value is null then minimum_value := in_observation;
else minimum_value := least(minimum_value, in_observation);
end if;
observations := observations + 1;
end add_observation;
end;
/
create or replace package test_simple_object authid definer
as
procedure wtplsql_run;
end test_simple_object;
/
create or replace package body test_simple_object
as
--% WTPLSQL SET DBOUT "SIMPLE_TEST_OBJ_TYPE:TYPE BODY" %--
procedure t_constructor
is
simple_test_obj simple_test_obj_type;
begin
wt_assert.g_testcase := 'Constructor Happy Path 1';
simple_test_obj := simple_test_obj_type();
wt_assert.isnull(msg_in => 'Object MINIMUM_VALUE'
,check_this_in => simple_test_obj.MINIMUM_VALUE);
wt_assert.eq(msg_in => 'Object OBSERVATIONS'
,check_this_in => simple_test_obj.OBSERVATIONS
,against_this_in => 0);
end t_constructor;
procedure wtplsql_run
as
begin
t_constructor;
end wtplsql_run;
end test_simple_object;
/
set serveroutput on size unlimited format word_wrapped
begin
wtplsql.test_run('TEST_SIMPLE_OBJECT');
wt_text_report.dbms_out(USER,'TEST_SIMPLE_OBJECT',30);
end;
/