From be3258068761a7c9eba329d205195f4cb3dd1eef Mon Sep 17 00:00:00 2001 From: totycro Date: Sun, 22 May 2011 22:13:33 +0200 Subject: Added preset ranges for values to accout --- bank-eiffel/tests/test_account.e | 16 +++++++++++++++- 1 file changed, 15 insertions(+), 1 deletion(-) (limited to 'bank-eiffel/tests') diff --git a/bank-eiffel/tests/test_account.e b/bank-eiffel/tests/test_account.e index a460023..3086402 100644 --- a/bank-eiffel/tests/test_account.e +++ b/bank-eiffel/tests/test_account.e @@ -20,10 +20,24 @@ feature -- Test routines person1: PERSON person2: PERSON account: ACCOUNT + cre: ARRAY[REAL_64] + deb_rng: ARRAY[REAL_64] + dep_rng: ARRAY[REAL_64] do create person1.make ("SOME_SURNAME_1", "SOME_FIRSTNAME_1") create person2.make ("SOME_SURNAME_2", "SOME_FIRSTNAME_2") - create account.make (person1) + + create cre.make_filled (0.0, 0, 1) + cre.put (-100.0, 0) + cre.put (-50.0, 1) + create deb_rng.make(0,1) + deb_rng.put (0.1, 0) + deb_rng.put (2.2, 1) + create dep_rng.make(0,1) + dep_rng.put (0.1, 0) + dep_rng.put (2.2, 1) + + create account.make (person1, 1.0, 2.0, -50.0, deb_rng, dep_rng, cre) account.add_authorized_signer (person2) --assert ("not_implemented", False) end -- cgit v1.2.3 From 3d70ca15591e4f4db578ba44fda674e6e44a7e56 Mon Sep 17 00:00:00 2001 From: totycro Date: Sun, 22 May 2011 23:12:59 +0200 Subject: members should be private --- bank-eiffel/tests/test_account.e | 2 ++ 1 file changed, 2 insertions(+) (limited to 'bank-eiffel/tests') diff --git a/bank-eiffel/tests/test_account.e b/bank-eiffel/tests/test_account.e index 3086402..6e65f52 100644 --- a/bank-eiffel/tests/test_account.e +++ b/bank-eiffel/tests/test_account.e @@ -39,6 +39,8 @@ feature -- Test routines create account.make (person1, 1.0, 2.0, -50.0, deb_rng, dep_rng, cre) account.add_authorized_signer (person2) + + --assert ("not_implemented", False) end -- cgit v1.2.3 From 3d0cdbe62989a59975938d4a0ab734d3e7f41be8 Mon Sep 17 00:00:00 2001 From: totycro Date: Mon, 23 May 2011 01:21:19 +0200 Subject: added advance --- bank-eiffel/tests/test_account.e | 31 ++++++++++++++++--------------- 1 file changed, 16 insertions(+), 15 deletions(-) (limited to 'bank-eiffel/tests') diff --git a/bank-eiffel/tests/test_account.e b/bank-eiffel/tests/test_account.e index 6e65f52..e0dfe4d 100644 --- a/bank-eiffel/tests/test_account.e +++ b/bank-eiffel/tests/test_account.e @@ -20,30 +20,31 @@ feature -- Test routines person1: PERSON person2: PERSON account: ACCOUNT - cre: ARRAY[REAL_64] - deb_rng: ARRAY[REAL_64] - dep_rng: ARRAY[REAL_64] do create person1.make ("SOME_SURNAME_1", "SOME_FIRSTNAME_1") create person2.make ("SOME_SURNAME_2", "SOME_FIRSTNAME_2") - create cre.make_filled (0.0, 0, 1) - cre.put (-100.0, 0) - cre.put (-50.0, 1) - create deb_rng.make(0,1) - deb_rng.put (0.1, 0) - deb_rng.put (2.2, 1) - create dep_rng.make(0,1) - dep_rng.put (0.1, 0) - dep_rng.put (2.2, 1) - - create account.make (person1, 1.0, 2.0, -50.0, deb_rng, dep_rng, cre) + 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) --assert ("not_implemented", False) end -end + ADVANCE + local + person1: PERSON + account: ACCOUNT + b : REAL_64 + 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) + end +end -- cgit v1.2.3 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 From 1daf62f05c19e6f96d16d3688055dfd20d89d2b8 Mon Sep 17 00:00:00 2001 From: manuel Date: Mon, 23 May 2011 20:37:54 +0200 Subject: - add tests - remove notes - fix minamount for subaccounts --- bank-eiffel/tests/test_account.e | 111 ++++++++++++++++++++++++++++++++------- bank-eiffel/tests/test_person.e | 37 ++++--------- 2 files changed, 101 insertions(+), 47 deletions(-) (limited to 'bank-eiffel/tests') diff --git a/bank-eiffel/tests/test_account.e b/bank-eiffel/tests/test_account.e index e1ca892..4430ab0 100644 --- a/bank-eiffel/tests/test_account.e +++ b/bank-eiffel/tests/test_account.e @@ -1,12 +1,3 @@ -note - description: "[ - Eiffel tests that can be executed by testing tool. - ]" - author: "EiffelStudio test wizard" - date: "$Date$" - revision: "$Revision$" - testing: "type/manual" - class TEST_ACCOUNT @@ -23,11 +14,13 @@ feature -- Test routines 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 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) @@ -66,20 +59,100 @@ feature -- Test routines CREATE_STUDENTACCOUNT local - person: STUDENT + 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 + + CREATE_STUDENTACCOUNT_ONLY_STUDENTS + local account: STUDENTACCOUNT + student: STUDENT + person: PERSON + retiree: RETIREE + retry_count: INTEGER 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]) + create student.make("STUDENT", "STUDENT") + create person.make("PERSON", "PERSON") + create retiree.make("RETIREE", "RETIREE") + + if retry_count = 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("CREATE_STUDENTACCOUNT_ONLY_STUDENTS_1", False) + elseif retry_count = 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("CREATE_STUDENTACCOUNT_ONLY_STUDENTS_2", False) + elseif retry_count = 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("CREATE_STUDENTACCOUNT_ONE_STUDENT_ONLY_1", False) + elseif retry_count = 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("CREATE_STUDENTACCOUNT_ONE_STUDENT_ONLY_2", False) + elseif retry_count = 4 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 (retiree) + assert("CREATE_STUDENTACCOUNT_ONE_STUDENT_ONLY_3", False) + end + rescue + if not (create {EXCEPTIONS}).is_developer_exception then + retry_count := retry_count + 1 + retry + end end CREATE_RETIREEACCOUNT local - person: RETIREE + retiree: 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]) + 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 -end + + CREATE_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") + + if retry_count = 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("CREATE_RETIREEACCOUNT_ONLY_RETIREES_1", False) + elseif retry_count = 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("CREATE_RETIREEACCOUNT_ONLY_RETIREES_2", False) + elseif retry_count = 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("CREATE_RETIREEACCOUNT_ONE_RETIREE_ONLY_1", False) + elseif retry_count = 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("CREATE_RETIREEACCOUNT_ONE_RETIREE_ONLY_2", False) + elseif retry_count = 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("CREATE_RETIREEACCOUNT_ONE_RETIREE_ONLY_3", False) + end + rescue + if not (create {EXCEPTIONS}).is_developer_exception then + retry_count := retry_count + 1 + retry + end + end +end diff --git a/bank-eiffel/tests/test_person.e b/bank-eiffel/tests/test_person.e index 67aea34..f42767c 100644 --- a/bank-eiffel/tests/test_person.e +++ b/bank-eiffel/tests/test_person.e @@ -1,12 +1,3 @@ -note - description: "[ - Eiffel tests that can be executed by testing tool. - ]" - author: "EiffelStudio test wizard" - date: "$Date$" - revision: "$Revision$" - testing: "type/manual" - class TEST_PERSON @@ -14,10 +5,11 @@ inherit EQA_TEST_SET feature -- Test routines - CREATE_EDIT_PERSON local person: PERSON + student: STUDENT + retiree: RETIREE do create person.make("SOME_SURNAME_1", "SOME_FIRSTNAME_1") assert("CREATE_EDIT_PERSON_FIRSTNAME_1", person.firstname.is_equal("SOME_FIRSTNAME_1")) @@ -27,31 +19,28 @@ feature -- Test routines assert("CREATE_EDIT_PERSON_FIRSTNAME_2", person.firstname.is_equal("SOME_FIRSTNAME_2")) person.surname := "SOME_SURNAME_2" assert("CREATE_EDIT_PERSON_SURNAME_2", person.surname.is_equal("SOME_SURNAME_2")) + + create student.make ("STUDENT_SURNAME", "STUDENT_FIRSTNAME") + assert("CREATE_EDIT_PERSON_STUDENT", attached {PERSON} student) + create retiree.make ("RETIREE_SURNAME", "RETIREE_FIRSTNAME") + assert("CREATE_EDIT_PERSON_RETIREE", attached {PERSON} student) end CREATE_EDIT_PERSON_EMPTY_SURNAME local person: PERSON retry_count: INTEGER - doretry: BOOLEAN do if retry_count = 0 then - doretry := True create person.make("", "SOME_FIRSTNAME") - doretry := False assert("CREATE_EDIT_PERSON_EMPTY_SURNAME_1", False) elseif retry_count = 1 then - doretry := False create person.make("SOME_SURNAME", "SOME_FIRSTNAME") - doretry := True person.surname := "" - doretry := False assert("CREATE_EDIT_PERSON_EMPTY_SURNAME_3", False) - else - doretry := False end rescue - if doretry then + if not (create {EXCEPTIONS}).is_developer_exception then retry_count := retry_count + 1 retry end @@ -61,25 +50,17 @@ feature -- Test routines local person: PERSON retry_count: INTEGER - doretry: BOOLEAN do if retry_count = 0 then - doretry := True create person.make("SOME_SURNAME", "") - doretry := False assert("CREATE_EDIT_PERSON_EMPTY_FIRSTNAME_1", False) elseif retry_count = 1 then - doretry := False create person.make("SOME_SURNAME", "SOME_FIRSTNAME") - doretry := True person.firstname := "" - doretry := False assert("CREATE_EDIT_PERSON_EMPTY_FIRSTNAME_3", False) - else - doretry := False end rescue - if doretry then + if not (create {EXCEPTIONS}).is_developer_exception then retry_count := retry_count + 1 retry end -- cgit v1.2.3 From 9a787349e121be1ad9e83d4086244cd90422ee0e Mon Sep 17 00:00:00 2001 From: manuel Date: Mon, 23 May 2011 21:30:40 +0200 Subject: more tests --- bank-eiffel/tests/test_account.e | 139 ++++++++++++++++++++++++++++++++------- bank-eiffel/tests/test_person.e | 24 ++++--- 2 files changed, 131 insertions(+), 32 deletions(-) (limited to 'bank-eiffel/tests') diff --git a/bank-eiffel/tests/test_account.e b/bank-eiffel/tests/test_account.e index 4430ab0..212ad6a 100644 --- a/bank-eiffel/tests/test_account.e +++ b/bank-eiffel/tests/test_account.e @@ -57,6 +57,97 @@ feature -- Test routines 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 + i: 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 @@ -68,7 +159,7 @@ feature -- Test routines assert("CREATE_STUDENTACCOUNT_MINAMOUNT", account.transfer_minamount = 1.0) end - CREATE_STUDENTACCOUNT_ONLY_STUDENTS + STUDENTACCOUNT_ONLY_STUDENTS local account: STUDENTACCOUNT student: STUDENT @@ -80,24 +171,26 @@ feature -- Test routines create person.make("PERSON", "PERSON") create retiree.make("RETIREE", "RETIREE") - if retry_count = 0 then + 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("CREATE_STUDENTACCOUNT_ONLY_STUDENTS_1", False) - elseif retry_count = 1 then + 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("CREATE_STUDENTACCOUNT_ONLY_STUDENTS_2", False) - elseif retry_count = 2 then + 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("CREATE_STUDENTACCOUNT_ONE_STUDENT_ONLY_1", False) - elseif retry_count = 3 then + 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("CREATE_STUDENTACCOUNT_ONE_STUDENT_ONLY_2", False) - elseif retry_count = 4 then + 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]) account.add_authorized_signer (retiree) - assert("CREATE_STUDENTACCOUNT_ONE_STUDENT_ONLY_3", False) + assert("STUDENTACCOUNT_ONE_STUDENT_ONLY_3", False) + else end rescue if not (create {EXCEPTIONS}).is_developer_exception then @@ -118,7 +211,7 @@ feature -- Test routines end - CREATE_RETIREEACCOUNT_ONLY_RETIREES + RETIREEACCOUNT_ONLY_RETIREES local account: RETIREEACCOUNT retiree: RETIREE @@ -130,24 +223,26 @@ feature -- Test routines create person.make("PERSON", "PERSON") create student.make("STUDENT", "STUDENT") - if retry_count = 0 then + 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("CREATE_RETIREEACCOUNT_ONLY_RETIREES_1", False) - elseif retry_count = 1 then + 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("CREATE_RETIREEACCOUNT_ONLY_RETIREES_2", False) - elseif retry_count = 2 then + 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("CREATE_RETIREEACCOUNT_ONE_RETIREE_ONLY_1", False) - elseif retry_count = 3 then + 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("CREATE_RETIREEACCOUNT_ONE_RETIREE_ONLY_2", False) - elseif retry_count = 4 then + 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("CREATE_RETIREEACCOUNT_ONE_RETIREE_ONLY_3", False) + assert("RETIREEACCOUNT_ONE_RETIREE_ONLY_3", False) + else end rescue if not (create {EXCEPTIONS}).is_developer_exception then diff --git a/bank-eiffel/tests/test_person.e b/bank-eiffel/tests/test_person.e index f42767c..01e9a50 100644 --- a/bank-eiffel/tests/test_person.e +++ b/bank-eiffel/tests/test_person.e @@ -26,18 +26,20 @@ feature -- Test routines assert("CREATE_EDIT_PERSON_RETIREE", attached {PERSON} student) end - CREATE_EDIT_PERSON_EMPTY_SURNAME + PERSON_EMPTY_SURNAME local person: PERSON retry_count: INTEGER do - if retry_count = 0 then + inspect retry_count + when 0 then create person.make("", "SOME_FIRSTNAME") - assert("CREATE_EDIT_PERSON_EMPTY_SURNAME_1", False) - elseif retry_count = 1 then + assert("PERSON_EMPTY_SURNAME_1", False) + when 1 then create person.make("SOME_SURNAME", "SOME_FIRSTNAME") person.surname := "" - assert("CREATE_EDIT_PERSON_EMPTY_SURNAME_3", False) + assert("PERSON_EMPTY_SURNAME_3", False) + else end rescue if not (create {EXCEPTIONS}).is_developer_exception then @@ -46,18 +48,20 @@ feature -- Test routines end end - CREATE_EDIT_PERSON_EMPTY_FIRSTNAME + PERSON_EMPTY_FIRSTNAME local person: PERSON retry_count: INTEGER do - if retry_count = 0 then + inspect retry_count + when 0 then create person.make("SOME_SURNAME", "") - assert("CREATE_EDIT_PERSON_EMPTY_FIRSTNAME_1", False) - elseif retry_count = 1 then + assert("PERSON_EMPTY_FIRSTNAME_1", False) + when 1 then create person.make("SOME_SURNAME", "SOME_FIRSTNAME") person.firstname := "" - assert("CREATE_EDIT_PERSON_EMPTY_FIRSTNAME_3", False) + assert("PERSON_EMPTY_FIRSTNAME_3", False) + else end rescue if not (create {EXCEPTIONS}).is_developer_exception then -- cgit v1.2.3 From 4c7743e63274a67136d849dea75262262221a570 Mon Sep 17 00:00:00 2001 From: manuel Date: Tue, 24 May 2011 18:04:21 +0200 Subject: adding bank example app (not fully implemented yet) --- bank-eiffel/tests/test_account.e | 1 - 1 file changed, 1 deletion(-) (limited to 'bank-eiffel/tests') diff --git a/bank-eiffel/tests/test_account.e b/bank-eiffel/tests/test_account.e index 212ad6a..0b6ac46 100644 --- a/bank-eiffel/tests/test_account.e +++ b/bank-eiffel/tests/test_account.e @@ -104,7 +104,6 @@ feature -- Test routines person2: PERSON account2: ACCOUNT retry_count: INTEGER - i: INTEGER do create person1.make("PERSON1", "PERSON1") create person2.make("PERSON2", "PERSON2") -- cgit v1.2.3