class TEST_ACCOUNT inherit EQA_TEST_SET feature -- Test routines CREATE_EDIT_ACCOUNT local person1: PERSON person2: PERSON person3: PERSON account1: ACCOUNT account2: ACCOUNT do 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) 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) 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 CREATE_STUDENTACCOUNT local 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 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 retiree: RETIREE account: RETIREEACCOUNT do 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 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