From e03195a9325d2671208efc45f4a4d083664eafe2 Mon Sep 17 00:00:00 2001 From: manuel Date: Mon, 23 May 2011 19:28:45 +0200 Subject: make all void-safe and much more improvements --- bank-eiffel/tests/test_account.e | 65 ++++++++++++++++++++++++++++++---------- bank-eiffel/tests/test_person.e | 22 -------------- 2 files changed, 50 insertions(+), 37 deletions(-) (limited to 'bank-eiffel/tests') 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 local person1: PERSON person2: PERSON - account: ACCOUNT + person3: PERSON + account1: ACCOUNT + account2: ACCOUNT do create person1.make ("SOME_SURNAME_1", "SOME_FIRSTNAME_1") create person2.make ("SOME_SURNAME_2", "SOME_FIRSTNAME_2") + create person3.make ("SOME_SURNAME_3", "SOME_FIRSTNAME_3") - create account.make (person1, 0.01, 0.02, -50.0, <<0.01, 0.022>>, <<0.01, 0.02>>, <<-100, -50>>) - account.add_authorized_signer (person2) + 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_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) - --assert ("not_implemented", False) + 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 - ADVANCE + CREATE_STUDENTACCOUNT local - person1: PERSON - account: ACCOUNT - b : REAL_64 + person: STUDENT + account: STUDENTACCOUNT do - create person1.make ("SOME_SURNAME_1", "SOME_FIRSTNAME_1") - create account.make (person1, 0.01, 0.02, -50.0, <<0.01, 0.022>>, <<0.01, 0.02>>, <<-100, -50>>) - - account.deposit (100.0, person1) - account.advance - - assert("balance not correct", account.get_balance = 101.0) + create person.make("SOME_SURNAME", "SOME_FIRSTNAME") + create account.make(person, 0.01, 0.02, -50.0, [0.01, 0.022], [0.01, 0.02], [-100.0, -50.0]) end + CREATE_RETIREEACCOUNT + local + person: RETIREE + account: RETIREEACCOUNT + do + create person.make("SOME_SURNAME", "SOME_FIRSTNAME") + create account.make(person, 0.01, 0.02, -50.0, [0.01, 0.022], [0.01, 0.02], [-100.0, -50.0]) + end end 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 doretry := False assert("CREATE_EDIT_PERSON_EMPTY_SURNAME_1", False) elseif retry_count = 1 then - create person.make(void, "SOME_FIRSTNAME") - doretry := False - assert("CREATE_EDIT_PERSON_EMPTY_SURNAME_2", False) - elseif retry_count = 2 then doretry := False create person.make("SOME_SURNAME", "SOME_FIRSTNAME") doretry := True person.surname := "" doretry := False assert("CREATE_EDIT_PERSON_EMPTY_SURNAME_3", False) - elseif retry_count = 3 then - doretry := False - create person.make("SOME_SURNAME", "SOME_FIRSTNAME") - doretry := True - person.surname := void - doretry := False - assert("CREATE_EDIT_PERSON_EMPTY_SURNAME_4", False) else doretry := False end @@ -80,23 +69,12 @@ feature -- Test routines doretry := False assert("CREATE_EDIT_PERSON_EMPTY_FIRSTNAME_1", False) elseif retry_count = 1 then - create person.make("SOME_SURNAME", void) - doretry := False - assert("CREATE_EDIT_PERSON_EMPTY_FIRSTNAME_2", False) - elseif retry_count = 2 then doretry := False create person.make("SOME_SURNAME", "SOME_FIRSTNAME") doretry := True person.firstname := "" doretry := False assert("CREATE_EDIT_PERSON_EMPTY_FIRSTNAME_3", False) - elseif retry_count = 3 then - doretry := False - create person.make("SOME_SURNAME", "SOME_FIRSTNAME") - doretry := True - person.firstname := void - doretry := False - assert("CREATE_EDIT_PERSON_EMPTY_FIRSTNAME_4", False) else doretry := False end -- cgit v1.2.3