summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authormanuel <manuel@mausz.at>2011-05-23 19:28:45 +0200
committermanuel <manuel@mausz.at>2011-05-23 19:28:45 +0200
commite03195a9325d2671208efc45f4a4d083664eafe2 (patch)
tree5a874c5e2957478ff242844ca98866c09dd7f2f7
parent3d0cdbe62989a59975938d4a0ab734d3e7f41be8 (diff)
downloadfoop-e03195a9325d2671208efc45f4a4d083664eafe2.tar.gz
foop-e03195a9325d2671208efc45f4a4d083664eafe2.tar.bz2
foop-e03195a9325d2671208efc45f4a4d083664eafe2.zip
make all void-safe
and much more improvements
-rw-r--r--bank-eiffel/account.e151
-rw-r--r--bank-eiffel/bank.e21
-rw-r--r--bank-eiffel/bank.ecf2
-rw-r--r--bank-eiffel/person.e10
-rw-r--r--bank-eiffel/retiree.e3
-rw-r--r--bank-eiffel/retireeaccount.e10
-rw-r--r--bank-eiffel/student.e3
-rw-r--r--bank-eiffel/studentaccount.e10
-rw-r--r--bank-eiffel/tests/test_account.e65
-rw-r--r--bank-eiffel/tests/test_person.e22
10 files changed, 164 insertions, 133 deletions
diff --git a/bank-eiffel/account.e b/bank-eiffel/account.e
index 61145f0..d0a3fc4 100644
--- a/bank-eiffel/account.e
+++ b/bank-eiffel/account.e
@@ -10,32 +10,10 @@ class
10create 10create
11 make 11 make
12 12
13-- TODO 13feature -- Access
14-- interest should defined by bank (via make?)
15-- add more checks to invariant (like balance >= creditline) ?
16-- check if balance is a getter and not a setter (doesn't has an assign)
17-- + check if authorized_signers is a getter and not a setter (it doesn't has an assign)
18-- -> if not: add a getter (via Result or so..) and move them to {NONE}
19-- much other stuff to test like: lower creditline so that balance will be invalid
20 14
21feature {NONE} -- Access 15 balance: REAL_64
22 16 -- Kontostand
23 creditline_range: ARRAY[REAL_64]
24 attribute Result := ({like creditline_range}).default end --| Remove line when Void Safety is properly set
25
26 interest_debit_range: ARRAY[REAL_64]
27 attribute Result := ({like interest_debit_range}).default end --| Remove line when Void Safety is properly set
28
29 interest_deposit_range: ARRAY[REAL_64]
30 -- min/max for interest_deposit
31 attribute Result := ({like interest_deposit_range}).default end --| Remove line when Void Safety is properly set
32
33 transfer_minamount: REAL_64 assign set_transfer_minamount
34 -- Mindestbetrag für jede Einzahlung, Auszahlung und Überweisung
35
36 authorized_signers: ARRAYED_SET [PERSON]
37 -- Zeichnungsberechtigte
38 attribute Result := ({like authorized_signers}).default end --| Remove line when Void Safety is properly set
39 17
40 creditline: REAL_64 assign set_creditline 18 creditline: REAL_64 assign set_creditline
41 -- Kreditrahmen 19 -- Kreditrahmen
@@ -46,25 +24,36 @@ feature {NONE} -- Access
46 interest_debit: REAL_64 assign set_interest_debit 24 interest_debit: REAL_64 assign set_interest_debit
47 -- Sollverzinsung 25 -- Sollverzinsung
48 26
49 balance: REAL_64 27 transfer_minamount: REAL_64 assign set_transfer_minamount
50 -- Kontostand 28 -- Mindestbetrag fuer jede Einzahlung, Auszahlung und Ueberweisung
29
30feature {NONE} -- Implementation
31
32 creditline_range: TUPLE [min: like creditline; max: like creditline]
33 -- min/max for creditline
34
35 interest_deposit_range: TUPLE [min: like interest_deposit; max: like interest_deposit]
36 -- min/max for interest_deposit
37
38 interest_debit_range: TUPLE [min: like interest_debit; max: like interest_debit]
39 -- min/max for interest_debit
40
41 authorized_signers: ARRAYED_SET [PERSON]
42 -- Zeichnungsberechtigte
51 43
52feature {NONE} -- Initialization 44feature {NONE} -- Initialization
53 45
54 make (an_authorized_signer: PERSON; 46 make (an_authorized_signer: PERSON;
55 an_interest_deposit: REAL_64; 47 an_interest_deposit: like interest_deposit;
56 an_interest_debit: REAL_64; 48 an_interest_debit: like interest_debit;
57 a_credit_line: REAL_64; 49 a_credit_line: like creditline;
58 an_interest_deposit_range: ARRAY[REAL_64]; 50 an_interest_deposit_range: like interest_deposit_range;
59 an_interest_debit_range: ARRAY[REAL_64]; 51 an_interest_debit_range: like interest_debit_range;
60 a_credit_line_range: ARRAY[REAL_64]) 52 a_credit_line_range: like creditline_range)
61 require 53 require
62 a_credit_line_range.count() = 2 54 a_credit_line_range.min < a_credit_line_range.max
63 an_interest_debit_range.count() = 2 55 an_interest_debit_range.min < an_interest_debit_range.max
64 an_interest_deposit_range.count() = 2 56 an_interest_deposit_range.min < an_interest_deposit_range.max
65 a_credit_line_range.item (1) < a_credit_line_range.item (2)
66 an_interest_debit_range.item (1) < an_interest_debit_range.item (2)
67 an_interest_deposit_range.item (1) < an_interest_deposit_range.item (2)
68 do 57 do
69 create authorized_signers.make(1) 58 create authorized_signers.make(1)
70 add_authorized_signer (an_authorized_signer) 59 add_authorized_signer (an_authorized_signer)
@@ -82,9 +71,8 @@ feature -- Basic operations
82 71
83 deposit (an_amount: like transfer_minamount; an_authorized_signer: PERSON) 72 deposit (an_amount: like transfer_minamount; an_authorized_signer: PERSON)
84 require 73 require
85 an_authorized_signer_authorized: has_authorized_signer (an_authorized_signer) 74 an_authorized_signer_authorized: get_authorized_signers.has (an_authorized_signer)
86 an_amount_positive: an_amount > 0.0 75 transfer_minamount_ok: an_amount >= transfer_minamount
87 transfer_minamount_ok: an_amount >= get_transfer_minamount
88 do 76 do
89 balance := balance + an_amount 77 balance := balance + an_amount
90 ensure 78 ensure
@@ -94,71 +82,55 @@ feature -- Basic operations
94 82
95 withdraw (an_amount: like transfer_minamount; an_authorized_signer: PERSON) 83 withdraw (an_amount: like transfer_minamount; an_authorized_signer: PERSON)
96 require 84 require
97 an_authorized_signer_authorized: has_authorized_signer (an_authorized_signer) 85 an_authorized_signer_authorized: get_authorized_signers.has (an_authorized_signer)
98 an_amount_positive: an_amount > 0.0 86 transfer_minamount_ok: an_amount >= transfer_minamount
99 transfer_minamount_ok: an_amount >= get_transfer_minamount
100 do 87 do
101 balance := balance - an_amount 88 balance := balance - an_amount
102 ensure 89 ensure
103 balance_decreased: balance < old balance 90 balance_decreased: balance < old balance
104 withdrawed: balance = old balance - an_amount 91 withdrawed: balance = old balance - an_amount
105 creditline_ok: balance >= creditline 92 balance_beneath_creditline: balance >= creditline
106 end 93 end
107 94
108 transfer(an_amount: like transfer_minamount; an_authorized_signer: PERSON; an_account: like Current; another_authorized_signer: PERSON;) 95 transfer(an_amount: like transfer_minamount; an_authorized_signer: PERSON;
109 require 96 an_account: like Current; another_authorized_signer: PERSON)
110 an_account_attached: an_account /= Void
111 do 97 do
112 withdraw (an_amount, an_authorized_signer) 98 withdraw (an_amount, an_authorized_signer)
113 an_account.deposit (an_amount, another_authorized_signer) 99 an_account.deposit (an_amount, another_authorized_signer)
114 end 100 end
115 101
116 add_authorized_signer (an_authorized_signer: PERSON) 102 add_authorized_signer (an_authorized_signer: PERSON)
117 require
118 an_authorized_signer_attached: an_authorized_signer /= Void
119 an_authorized_signer_notinlist: not has_authorized_signer (an_authorized_signer)
120 do 103 do
121 authorized_signers.put (an_authorized_signer) 104 if not authorized_signers.has (an_authorized_signer) then
105 authorized_signers.put (an_authorized_signer)
106 end
122 ensure 107 ensure
123 authorized_signers_assigned: authorized_signers.has (an_authorized_signer) 108 authorized_signers_assigned: authorized_signers.has (an_authorized_signer)
124 end 109 end
125 110
126 remove_authorized_signer (an_authorized_signer: PERSON) 111 remove_authorized_signer (an_authorized_signer: PERSON)
127 require 112 require
128 an_authorized_signer_attached: an_authorized_signer /= Void 113 authorized_signers_never_empty: get_authorized_signers.count >= 2
129 an_authorized_signer_inlist: has_authorized_signer (an_authorized_signer)
130 authorized_signers_never_empty: authorized_signers_count >= 2
131 do 114 do
132 authorized_signers.prune (an_authorized_signer) 115 if authorized_signers.has (an_authorized_signer) then
116 authorized_signers.prune (an_authorized_signer)
117 end
133 ensure 118 ensure
134 authorized_signers_assigned: not authorized_signers.has (an_authorized_signer) 119 authorized_signers_assigned: not authorized_signers.has (an_authorized_signer)
135 end 120 end
136 121
137 has_authorized_signer (an_authorized_signer: PERSON) : BOOLEAN 122 get_authorized_signers: FINITE [PERSON]
138 do 123 do
139 Result := authorized_signers.has (an_authorized_signer) 124 Result := authorized_signers
140 end
141
142 authorized_signers_count : INTEGER
143 do
144 Result := authorized_signers.count
145 end
146
147 get_transfer_minamount : REAL_64
148 do
149 Result := transfer_minamount
150 end
151
152 get_balance : REAL_64
153 do
154 Result := balance
155 end 125 end
156 126
157 advance 127 advance
158 do 128 do
159 if balance < 0.0 then -- debit 129 if balance < 0.0 then
130 -- debit
160 balance := balance + (balance * interest_debit) 131 balance := balance + (balance * interest_debit)
161 else -- deposit 132 else
133 -- deposit
162 balance := balance + (balance * interest_deposit) 134 balance := balance + (balance * interest_deposit)
163 end 135 end
164 end 136 end
@@ -166,7 +138,6 @@ feature -- Basic operations
166feature {NONE} -- Implementation 138feature {NONE} -- Implementation
167 139
168 set_transfer_minamount (a_transfer_minamount: like transfer_minamount) 140 set_transfer_minamount (a_transfer_minamount: like transfer_minamount)
169 -- Assign `transfer_minamount' with `a_transfer_minamount'.
170 require 141 require
171 a_transfer_minamount_positive: a_transfer_minamount > 0.0 142 a_transfer_minamount_positive: a_transfer_minamount > 0.0
172 do 143 do
@@ -176,7 +147,9 @@ feature {NONE} -- Implementation
176 end 147 end
177 148
178 set_creditline (a_creditline: like creditline) 149 set_creditline (a_creditline: like creditline)
179 -- Assign `creditline' with `a_creditline'. 150 require
151 a_creditline_within_bounds: a_creditline >= creditline_range.min
152 and a_creditline <= creditline_range.max
180 do 153 do
181 creditline := a_creditline 154 creditline := a_creditline
182 ensure 155 ensure
@@ -184,9 +157,9 @@ feature {NONE} -- Implementation
184 end 157 end
185 158
186 set_interest_deposit (an_interest_deposit: like interest_deposit) 159 set_interest_deposit (an_interest_deposit: like interest_deposit)
187 -- Assign `interest_deposit' with `an_interest_deposit'.
188 require 160 require
189 an_interest_deposit_within_bounds: an_interest_deposit >= 0.0 and an_interest_deposit <= 1.0 161 an_interest_deposit_within_bounds: interest_deposit >= interest_deposit_range.min
162 and interest_deposit <= interest_deposit_range.max
190 do 163 do
191 interest_deposit := an_interest_deposit 164 interest_deposit := an_interest_deposit
192 ensure 165 ensure
@@ -194,7 +167,9 @@ feature {NONE} -- Implementation
194 end 167 end
195 168
196 set_interest_debit (an_interest_debit: like interest_debit) 169 set_interest_debit (an_interest_debit: like interest_debit)
197 -- Assign `interest_debit' with `an_interest_debit'. 170 require
171 an_interest_deposit_within_bounds: interest_debit >= interest_debit_range.min
172 and interest_debit <= interest_debit_range.max
198 do 173 do
199 interest_debit := an_interest_debit 174 interest_debit := an_interest_debit
200 ensure 175 ensure
@@ -202,14 +177,12 @@ feature {NONE} -- Implementation
202 end 177 end
203 178
204invariant 179invariant
205 interest_debit_within_bounds:
206 interest_debit >= interest_debit_range.item (1) and
207 interest_debit <= interest_debit_range.item (2)
208 interest_deposit_within_bounds:
209 interest_deposit >= interest_deposit_range.item (1) and
210 interest_deposit <= interest_deposit_range.item (2)
211 authorized_signers_attached: authorized_signers /= Void
212 authorized_signers_not_empty: authorized_signers.count > 0 180 authorized_signers_not_empty: authorized_signers.count > 0
213 transfer_minamount_positive: transfer_minamount > 0.0 181 transfer_minamount_positive: transfer_minamount > 0.0
214 creditline_range_correct: creditline >= creditline_range.item (1) and creditline <= creditline_range.item (2) 182 creditline_within_bounds: creditline >= creditline_range.min
183 and creditline <= creditline_range.max
184 interest_debit_within_bounds: interest_debit >= interest_debit_range.min
185 and interest_debit <= interest_debit_range.max
186 interest_deposit_within_bounds: interest_deposit >= interest_deposit_range.min
187 and interest_deposit <= interest_deposit_range.max
215end 188end
diff --git a/bank-eiffel/bank.e b/bank-eiffel/bank.e
index 32d10ff..7c30afb 100644
--- a/bank-eiffel/bank.e
+++ b/bank-eiffel/bank.e
@@ -10,11 +10,32 @@ class
10create 10create
11 make 11 make
12 12
13feature {NONE} -- Implementation
14
15 customers: ARRAYED_SET [PERSON]
16 -- Kunden
17
18 accounts: ARRAYED_SET [ACCOUNT]
19 -- Vorname
20
13feature {NONE} -- Initialization 21feature {NONE} -- Initialization
14 22
15 make 23 make
16 do 24 do
25 create customers.make(100)
26 create accounts.make(100)
27 end
28
29feature -- Basic operations
17 30
31 get_customers: FINITE [PERSON]
32 do
33 Result := customers
34 end
35
36 get_accounts: FINITE [ACCOUNT]
37 do
38 Result := accounts
18 end 39 end
19 40
20end 41end
diff --git a/bank-eiffel/bank.ecf b/bank-eiffel/bank.ecf
index b3bf92c..1eef831 100644
--- a/bank-eiffel/bank.ecf
+++ b/bank-eiffel/bank.ecf
@@ -4,7 +4,7 @@
4 <description>FOOP Exercise #3</description> 4 <description>FOOP Exercise #3</description>
5 <root class="APPLICATION" feature="make"/> 5 <root class="APPLICATION" feature="make"/>
6 <version major="0" minor="1" release="0" build="0" product="bank"/> 6 <version major="0" minor="1" release="0" build="0" product="bank"/>
7 <option warning="true" void_safety="none"> 7 <option warning="true" is_attached_by_default="true" void_safety="all">
8 <assertions precondition="true" postcondition="true" check="true" invariant="true" loop="true" supplier_precondition="true"/> 8 <assertions precondition="true" postcondition="true" check="true" invariant="true" loop="true" supplier_precondition="true"/>
9 </option> 9 </option>
10 <setting name="executable_name" value="bank"/> 10 <setting name="executable_name" value="bank"/>
diff --git a/bank-eiffel/person.e b/bank-eiffel/person.e
index 54e1a45..9a2b281 100644
--- a/bank-eiffel/person.e
+++ b/bank-eiffel/person.e
@@ -14,11 +14,9 @@ feature -- Access
14 14
15 surname: STRING_8 assign set_surname 15 surname: STRING_8 assign set_surname
16 -- Nachname 16 -- Nachname
17 attribute Result := ({like surname}).default end --| Remove line when Void Safety is properly set
18 17
19 firstname: STRING_8 assign set_firstname 18 firstname: STRING_8 assign set_firstname
20 -- Vorname 19 -- Vorname
21 attribute Result := ({like firstname}).default end --| Remove line when Void Safety is properly set
22 20
23feature {NONE} -- Initialization 21feature {NONE} -- Initialization
24 22
@@ -33,7 +31,7 @@ feature {NONE} -- Implementation
33 set_surname (a_surname: like surname) 31 set_surname (a_surname: like surname)
34 -- Assign `surname' with `a_surname'. 32 -- Assign `surname' with `a_surname'.
35 require 33 require
36 a_surname_not_empty: a_surname /= Void and then not a_surname.is_empty 34 a_surname_not_empty: not a_surname.is_empty
37 do 35 do
38 surname := a_surname 36 surname := a_surname
39 ensure 37 ensure
@@ -43,7 +41,7 @@ feature {NONE} -- Implementation
43 set_firstname (a_firstname: like firstname) 41 set_firstname (a_firstname: like firstname)
44 -- Assign `firstname' with `a_firstname'. 42 -- Assign `firstname' with `a_firstname'.
45 require 43 require
46 a_firstname_not_empty: a_firstname /= Void and then not a_firstname.is_empty 44 a_firstname_not_empty: not a_firstname.is_empty
47 do 45 do
48 firstname := a_firstname 46 firstname := a_firstname
49 ensure 47 ensure
@@ -51,6 +49,6 @@ feature {NONE} -- Implementation
51 end 49 end
52 50
53invariant 51invariant
54 firstname_not_empty: firstname /= Void and then not firstname.is_empty 52 firstname_not_empty: not firstname.is_empty
55 surname_not_empty: surname /= Void and then not surname.is_empty 53 surname_not_empty: not surname.is_empty
56end 54end
diff --git a/bank-eiffel/retiree.e b/bank-eiffel/retiree.e
index 57e5d05..7f24d89 100644
--- a/bank-eiffel/retiree.e
+++ b/bank-eiffel/retiree.e
@@ -10,4 +10,7 @@ class
10inherit 10inherit
11 PERSON 11 PERSON
12 12
13create
14 make
15
13end 16end
diff --git a/bank-eiffel/retireeaccount.e b/bank-eiffel/retireeaccount.e
index 3f56fd4..cf9bc91 100644
--- a/bank-eiffel/retireeaccount.e
+++ b/bank-eiffel/retireeaccount.e
@@ -10,6 +10,16 @@ class
10inherit 10inherit
11 ACCOUNT 11 ACCOUNT
12 12
13create
14 make
15
13invariant 16invariant
14 authorized_signers_only_one: authorized_signers.count = 1 17 authorized_signers_only_one: authorized_signers.count = 1
18 authorized_signers_attached: authorized_signers.linear_representation /= Void
19 authorized_signers_only_retirees:
20 (attached authorized_signers.linear_representation as signers) implies signers.for_all(
21 agent (person: PERSON): BOOLEAN
22 do
23 Result := attached {RETIREE} person
24 end)
15end 25end
diff --git a/bank-eiffel/student.e b/bank-eiffel/student.e
index 2b5afd4..f910fa7 100644
--- a/bank-eiffel/student.e
+++ b/bank-eiffel/student.e
@@ -10,4 +10,7 @@ class
10inherit 10inherit
11 PERSON 11 PERSON
12 12
13create
14 make
15
13end 16end
diff --git a/bank-eiffel/studentaccount.e b/bank-eiffel/studentaccount.e
index a80d4bb..d1ccaef 100644
--- a/bank-eiffel/studentaccount.e
+++ b/bank-eiffel/studentaccount.e
@@ -10,6 +10,16 @@ class
10inherit 10inherit
11 ACCOUNT 11 ACCOUNT
12 12
13create
14 make
15
13invariant 16invariant
14 authorized_signers_only_one: authorized_signers.count = 1 17 authorized_signers_only_one: authorized_signers.count = 1
18 authorized_signers_attached: authorized_signers.linear_representation /= Void
19 authorized_signers_only_students:
20 (attached authorized_signers.linear_representation as signers) implies signers.for_all(
21 agent (person: PERSON): BOOLEAN
22 do
23 Result := attached {STUDENT} person
24 end)
15end 25end
diff --git a/bank-eiffel/tests/test_account.e b/bank-eiffel/tests/test_account.e
index e0dfe4d..e1ca892 100644
--- a/bank-eiffel/tests/test_account.e
+++ b/bank-eiffel/tests/test_account.e
@@ -19,32 +19,67 @@ feature -- Test routines
19 local 19 local
20 person1: PERSON 20 person1: PERSON
21 person2: PERSON 21 person2: PERSON
22 account: ACCOUNT 22 person3: PERSON
23 account1: ACCOUNT
24 account2: ACCOUNT
23 do 25 do
24 create person1.make ("SOME_SURNAME_1", "SOME_FIRSTNAME_1") 26 create person1.make ("SOME_SURNAME_1", "SOME_FIRSTNAME_1")
25 create person2.make ("SOME_SURNAME_2", "SOME_FIRSTNAME_2") 27 create person2.make ("SOME_SURNAME_2", "SOME_FIRSTNAME_2")
28 create person3.make ("SOME_SURNAME_3", "SOME_FIRSTNAME_3")
26 29
27 create account.make (person1, 0.01, 0.02, -50.0, <<0.01, 0.022>>, <<0.01, 0.02>>, <<-100, -50>>) 30 create account1.make (person1, 0.01, 0.02, -50.0, [0.01, 0.022], [0.01, 0.02], [-100.0, -50.0])
28 account.add_authorized_signer (person2) 31 assert("CREATE_EDIT_ACCOUNT_SIGNER_1", account1.get_authorized_signers.count = 1)
32 account1.add_authorized_signer (person2)
33 account1.add_authorized_signer (person2)
34 account1.add_authorized_signer (person3)
35 account1.remove_authorized_signer (person3)
36 assert("CREATE_EDIT_ACCOUNT_SIGNER_2", account1.get_authorized_signers.count = 2)
29 37
38 assert("CREATE_EDIT_ACCOUNT_BALANCE_1", account1.balance = 0.0)
39 account1.deposit (50.0, person1)
40 account1.deposit (50.0, person2)
41 -- balance = 100.0
42 account1.advance
43 -- balance = 100.0 + 1% deposit
44 account1.withdraw (100.0 + 100.0 * 0.01 + 50.0, person1)
45 -- balance = -50.0
46 account1.creditline := -100.0
47 account1.withdraw (50.0, person1)
48 -- balance = -100.0
49 account1.advance
50 -- balance = -100.0 + 2% debit
51 assert("CREATE_EDIT_ACCOUNT_BALANCE_2", account1.balance = -102.0)
30 52
31 --assert ("not_implemented", False) 53 create account2.make(person3, 0.01, 0.02, -50, [0.01, 0.022], [0.01, 0.02], [-100.0, -50.0])
54 account2.deposit (102.0, person3)
55 account2.transfer (102.0, person3, account1, person1)
56 assert("CREATE_EDIT_ACCOUNT_BALANCE_3", account1.balance = 0.0 and account2.balance = 0.0)
57
58 account1.interest_deposit := 0.01
59 account1.interest_deposit := 0.022
60 account1.interest_debit := 0.01
61 account1.interest_debit := 0.02
62 account1.creditline := -100.0
63 account1.creditline := -50.0
64 account1.transfer_minamount := 10.0
32 end 65 end
33 66
34 ADVANCE 67 CREATE_STUDENTACCOUNT
35 local 68 local
36 person1: PERSON 69 person: STUDENT
37 account: ACCOUNT 70 account: STUDENTACCOUNT
38 b : REAL_64
39 do 71 do
40 create person1.make ("SOME_SURNAME_1", "SOME_FIRSTNAME_1") 72 create person.make("SOME_SURNAME", "SOME_FIRSTNAME")
41 create account.make (person1, 0.01, 0.02, -50.0, <<0.01, 0.022>>, <<0.01, 0.02>>, <<-100, -50>>) 73 create account.make(person, 0.01, 0.02, -50.0, [0.01, 0.022], [0.01, 0.02], [-100.0, -50.0])
42
43 account.deposit (100.0, person1)
44 account.advance
45
46 assert("balance not correct", account.get_balance = 101.0)
47 end 74 end
48 75
76 CREATE_RETIREEACCOUNT
77 local
78 person: RETIREE
79 account: RETIREEACCOUNT
80 do
81 create person.make("SOME_SURNAME", "SOME_FIRSTNAME")
82 create account.make(person, 0.01, 0.02, -50.0, [0.01, 0.022], [0.01, 0.02], [-100.0, -50.0])
83 end
49end 84end
50 85
diff --git a/bank-eiffel/tests/test_person.e b/bank-eiffel/tests/test_person.e
index a501deb..67aea34 100644
--- a/bank-eiffel/tests/test_person.e
+++ b/bank-eiffel/tests/test_person.e
@@ -41,23 +41,12 @@ feature -- Test routines
41 doretry := False 41 doretry := False
42 assert("CREATE_EDIT_PERSON_EMPTY_SURNAME_1", False) 42 assert("CREATE_EDIT_PERSON_EMPTY_SURNAME_1", False)
43 elseif retry_count = 1 then 43 elseif retry_count = 1 then
44 create person.make(void, "SOME_FIRSTNAME")
45 doretry := False
46 assert("CREATE_EDIT_PERSON_EMPTY_SURNAME_2", False)
47 elseif retry_count = 2 then
48 doretry := False 44 doretry := False
49 create person.make("SOME_SURNAME", "SOME_FIRSTNAME") 45 create person.make("SOME_SURNAME", "SOME_FIRSTNAME")
50 doretry := True 46 doretry := True
51 person.surname := "" 47 person.surname := ""
52 doretry := False 48 doretry := False
53 assert("CREATE_EDIT_PERSON_EMPTY_SURNAME_3", False) 49 assert("CREATE_EDIT_PERSON_EMPTY_SURNAME_3", False)
54 elseif retry_count = 3 then
55 doretry := False
56 create person.make("SOME_SURNAME", "SOME_FIRSTNAME")
57 doretry := True
58 person.surname := void
59 doretry := False
60 assert("CREATE_EDIT_PERSON_EMPTY_SURNAME_4", False)
61 else 50 else
62 doretry := False 51 doretry := False
63 end 52 end
@@ -80,23 +69,12 @@ feature -- Test routines
80 doretry := False 69 doretry := False
81 assert("CREATE_EDIT_PERSON_EMPTY_FIRSTNAME_1", False) 70 assert("CREATE_EDIT_PERSON_EMPTY_FIRSTNAME_1", False)
82 elseif retry_count = 1 then 71 elseif retry_count = 1 then
83 create person.make("SOME_SURNAME", void)
84 doretry := False
85 assert("CREATE_EDIT_PERSON_EMPTY_FIRSTNAME_2", False)
86 elseif retry_count = 2 then
87 doretry := False 72 doretry := False
88 create person.make("SOME_SURNAME", "SOME_FIRSTNAME") 73 create person.make("SOME_SURNAME", "SOME_FIRSTNAME")
89 doretry := True 74 doretry := True
90 person.firstname := "" 75 person.firstname := ""
91 doretry := False 76 doretry := False
92 assert("CREATE_EDIT_PERSON_EMPTY_FIRSTNAME_3", False) 77 assert("CREATE_EDIT_PERSON_EMPTY_FIRSTNAME_3", False)
93 elseif retry_count = 3 then
94 doretry := False
95 create person.make("SOME_SURNAME", "SOME_FIRSTNAME")
96 doretry := True
97 person.firstname := void
98 doretry := False
99 assert("CREATE_EDIT_PERSON_EMPTY_FIRSTNAME_4", False)
100 else 78 else
101 doretry := False 79 doretry := False
102 end 80 end