summaryrefslogtreecommitdiffstats
path: root/bank-eiffel/tests/test_account.e
diff options
context:
space:
mode:
Diffstat (limited to 'bank-eiffel/tests/test_account.e')
-rw-r--r--bank-eiffel/tests/test_account.e65
1 files changed, 50 insertions, 15 deletions
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