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
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
|
class
TEST_ACCOUNT
inherit
EQA_TEST_SET
feature -- Test routines
CREATE_EDIT_ACCOUNT
local
person1: PERSON
person2: PERSON
person3: PERSON
account1: ACCOUNT
account2: ACCOUNT
do
create person1.make ("PERSON1", "PERSON1")
create person2.make ("PERSON2", "PERSON2")
create person3.make ("PERSON3", "PERSON3")
create account1.make (person1, 0.01, 0.02, -50.0, [0.01, 0.022], [0.01, 0.02], [-100.0, -50.0])
assert("CREATE_EDIT_ACCOUNT_MINAMOUNT", account1.transfer_minamount = 2.0)
assert("CREATE_EDIT_ACCOUNT_SIGNER_1", account1.get_authorized_signers.count = 1)
account1.add_authorized_signer (person2)
account1.add_authorized_signer (person2)
account1.add_authorized_signer (person3)
account1.remove_authorized_signer (person3)
assert("CREATE_EDIT_ACCOUNT_SIGNER_2", account1.get_authorized_signers.count = 2)
assert("CREATE_EDIT_ACCOUNT_BALANCE_1", account1.balance = 0.0)
account1.deposit (50.0, person1)
account1.deposit (50.0, person2)
-- balance = 100.0
account1.advance
-- balance = 100.0 + 1% deposit
account1.withdraw (100.0 + 100.0 * 0.01 + 50.0, person1)
-- balance = -50.0
account1.creditline := -100.0
account1.withdraw (50.0, person1)
-- balance = -100.0
account1.advance
-- balance = -100.0 + 2% debit
assert("CREATE_EDIT_ACCOUNT_BALANCE_2", account1.balance = -102.0)
create account2.make(person3, 0.01, 0.02, -50, [0.01, 0.022], [0.01, 0.02], [-100.0, -50.0])
account2.deposit (102.0, person3)
account2.transfer (102.0, person3, account1, person1)
assert("CREATE_EDIT_ACCOUNT_BALANCE_3", account1.balance = 0.0 and account2.balance = 0.0)
account1.interest_deposit := 0.01
account1.interest_deposit := 0.022
account1.interest_debit := 0.01
account1.interest_debit := 0.02
account1.creditline := -100.0
account1.creditline := -50.0
account1.transfer_minamount := 10.0
end
ACCOUNT_CHECK_RANGES
local
person: PERSON
account: ACCOUNT
retry_count: INTEGER
do
create person.make("PERSON", "PERSON")
create account.make(person, 0.01, 0.02, -50.0, [0.01, 0.022], [0.01, 0.02], [-100.0, -50.0])
inspect retry_count
when 0 then
account.interest_deposit := 0.0
assert("ACCOUNT_CHECK_RANGES_INTEREST_DEPOSIT_MIN", False)
when 1 then
account.interest_deposit := 0.023
assert("ACCOUNT_CHECK_RANGES_INTEREST_DEPOSIT_MAX", False)
when 2 then
account.interest_debit := 0.0
assert("ACCOUNT_CHECK_RANGES_INTEREST_DEBIT_MIN", False)
when 3 then
account.interest_debit := 0.03
assert("ACCOUNT_CHECK_RANGES_INTEREST_DEBIT_MAX", False)
when 4 then
account.creditline := -101.0
assert("ACCOUNT_CHECK_RANGES_CREDITLINE_MIN", False)
when 5 then
account.creditline := -49.0
assert("ACCOUNT_CHECK_RANGES_CREDITLINE_MAX", False)
when 6 then
account.transfer_minamount := -1.0
assert("ACCOUNT_CHECK_RANGES_TRANSFER_MINAMOUNT_POSITIVE", False)
else
end
rescue
if not (create {EXCEPTIONS}).is_developer_exception then
retry_count := retry_count + 1
retry
end
end
ACCOUNT_CHECK_OPERATIONS
local
person1: PERSON
account1: ACCOUNT
person2: PERSON
account2: ACCOUNT
retry_count: INTEGER
do
create person1.make("PERSON1", "PERSON1")
create person2.make("PERSON2", "PERSON2")
create account1.make(person1, 0.01, 0.02, -50.0, [0.01, 0.022], [0.01, 0.02], [-100.0, -50.0])
create account2.make(person2, 0.01, 0.02, -50.0, [0.01, 0.022], [0.01, 0.02], [-100.0, -50.0])
inspect retry_count
when 0 then
account1.deposit (10.0, person2)
assert("ACCOUNT_CHECK_OPERATIONS_DEPOSIT_OTHER", False)
when 1 then
account1.withdraw (10.0, person2)
assert("ACCOUNT_CHECK_OPERATIONS_WITHDRAW_OTHER", False)
when 2 then
account1.transfer (10.0, person2, account2, person2)
assert("ACCOUNT_CHECK_OPERATIONS_TRANSFER_OTHER_1", False)
when 3 then
account1.transfer (10.0, person1, account2, person1)
assert("ACCOUNT_CHECK_OPERATIONS_TRANSFER_OTHER_2", False)
when 4 then
account1.withdraw (51.0, person1)
assert("ACCOUNT_CHECK_OPERATIONS_WITHDRAW_OVER_CREDIT", False)
when 5 then
account1.deposit (1.0, person1)
assert("ACCOUNT_CHECK_OPERATIONS_DEPOSIT_BELOW_MINAMOUNT", False)
when 6 then
account1.withdraw (1.0, person1)
assert("ACCOUNT_CHECK_OPERATIONS_WITHDRAW_BELOW_MINAMOUNT", False)
when 7 then
account1.transfer (1.0, person1, account2, person2)
assert("ACCOUNT_CHECK_OPERATIONS_TRANSFER_BELOW_MINAMOUNT", False)
when 8 then
account1.remove_authorized_signer (person1)
assert("ACCOUNT_CHECK_OPERATIONS_REMOVE_AUTHORIZED_SIGNER_EMPTY", False)
else
end
rescue
if retry_count /= 9 and not (create {EXCEPTIONS}).is_developer_exception then
retry_count := retry_count + 1
retry
end
end
CREATE_STUDENTACCOUNT
local
student: STUDENT
account: STUDENTACCOUNT
do
create student.make("STUDENT", "STUDENT")
create account.make(student, 0.01, 0.02, -50.0, [0.01, 0.022], [0.01, 0.02], [-100.0, -50.0])
assert("CREATE_STUDENTACCOUNT", attached {ACCOUNT} account)
assert("CREATE_STUDENTACCOUNT_MINAMOUNT", account.transfer_minamount = 1.0)
end
STUDENTACCOUNT_ONLY_STUDENTS
local
account: STUDENTACCOUNT
student: STUDENT
person: PERSON
retiree: RETIREE
retry_count: INTEGER
do
create student.make("STUDENT", "STUDENT")
create person.make("PERSON", "PERSON")
create retiree.make("RETIREE", "RETIREE")
inspect retry_count
when 0 then
create account.make(person, 0.01, 0.02, -50.0, [0.01, 0.022], [0.01, 0.02], [-100.0, -50.0])
assert("STUDENTACCOUNT_ONLY_STUDENTS_1", False)
when 1 then
create account.make(retiree, 0.01, 0.02, -50.0, [0.01, 0.022], [0.01, 0.02], [-100.0, -50.0])
assert("STUDENTACCOUNT_ONLY_STUDENTS_2", False)
when 2 then
create account.make(student, 0.01, 0.02, -50.0, [0.01, 0.022], [0.01, 0.02], [-100.0, -50.0])
account.add_authorized_signer (create {STUDENT}.make("STUDENT2", "STUDENT2"))
assert("STUDENTACCOUNT_ONE_STUDENT_ONLY_1", False)
when 3 then
create account.make(student, 0.01, 0.02, -50.0, [0.01, 0.022], [0.01, 0.02], [-100.0, -50.0])
--account.add_authorized_signer (person)
assert("STUDENTACCOUNT_ONE_STUDENT_ONLY_2", False)
when 4 then
create account.make(student, 0.01, 0.02, -50.0, [0.01, 0.022], [0.01, 0.02], [-100.0, -50.0])
--daccount.add_authorized_signer (retiree)
assert("STUDENTACCOUNT_ONE_STUDENT_ONLY_3", False)
else
end
rescue
if not (create {EXCEPTIONS}).is_developer_exception then
retry_count := retry_count + 1
retry
end
end
CREATE_RETIREEACCOUNT
local
retiree: RETIREE
account: RETIREEACCOUNT
do
create retiree.make("RETIREE", "RETIREE")
create account.make(retiree, 0.01, 0.02, -50.0, [0.01, 0.022], [0.01, 0.02], [-100.0, -50.0])
assert("CREATE_RETIREEACCOUNT", attached {ACCOUNT} account)
assert("CREATE_RETIREEACCOUNT_MINAMOUNT", account.transfer_minamount = 1.0)
end
RETIREEACCOUNT_ONLY_RETIREES
local
account: RETIREEACCOUNT
retiree: RETIREE
person: PERSON
student: STUDENT
retry_count: INTEGER
do
create retiree.make("RETIREE", "RETIREE")
create person.make("PERSON", "PERSON")
create student.make("STUDENT", "STUDENT")
inspect retry_count
when 0 then
create account.make(person, 0.01, 0.02, -50.0, [0.01, 0.022], [0.01, 0.02], [-100.0, -50.0])
assert("RETIREEACCOUNT_ONLY_RETIREES_1", False)
when 1 then
create account.make(student, 0.01, 0.02, -50.0, [0.01, 0.022], [0.01, 0.02], [-100.0, -50.0])
assert("RETIREEACCOUNT_ONLY_RETIREES_2", False)
when 2 then
create account.make(retiree, 0.01, 0.02, -50.0, [0.01, 0.022], [0.01, 0.02], [-100.0, -50.0])
account.add_authorized_signer (create {RETIREE}.make("RETIREE2", "RETIREE2"))
assert("RETIREEACCOUNT_ONE_RETIREE_ONLY_1", False)
when 3 then
create account.make(retiree, 0.01, 0.02, -50.0, [0.01, 0.022], [0.01, 0.02], [-100.0, -50.0])
--account.add_authorized_signer (person)
--assert("RETIREEACCOUNT_ONE_RETIREE_ONLY_2", False)
when 4 then
create account.make(retiree, 0.01, 0.02, -50.0, [0.01, 0.022], [0.01, 0.02], [-100.0, -50.0])
--account.add_authorized_signer (student)
--assert("RETIREEACCOUNT_ONE_RETIREE_ONLY_3", False)
else
end
rescue
if not (create {EXCEPTIONS}).is_developer_exception then
retry_count := retry_count + 1
retry
end
end
end
|