summaryrefslogtreecommitdiffstats
path: root/bank-eiffel/tests
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 /bank-eiffel/tests
parent3d0cdbe62989a59975938d4a0ab734d3e7f41be8 (diff)
downloadfoop-e03195a9325d2671208efc45f4a4d083664eafe2.tar.gz
foop-e03195a9325d2671208efc45f4a4d083664eafe2.tar.bz2
foop-e03195a9325d2671208efc45f4a4d083664eafe2.zip
make all void-safe
and much more improvements
Diffstat (limited to 'bank-eiffel/tests')
-rw-r--r--bank-eiffel/tests/test_account.e65
-rw-r--r--bank-eiffel/tests/test_person.e22
2 files changed, 50 insertions, 37 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
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