diff options
Diffstat (limited to 'bank-eiffel')
| -rw-r--r-- | bank-eiffel/account.e | 2 | ||||
| -rw-r--r-- | bank-eiffel/bank.ecf | 17 | ||||
| -rw-r--r-- | bank-eiffel/person.e | 27 | ||||
| -rw-r--r-- | bank-eiffel/tests/test_account.e | 30 | ||||
| -rw-r--r-- | bank-eiffel/tests/test_person.e | 60 |
5 files changed, 119 insertions, 17 deletions
diff --git a/bank-eiffel/account.e b/bank-eiffel/account.e index 6c240de..8faabdc 100644 --- a/bank-eiffel/account.e +++ b/bank-eiffel/account.e | |||
| @@ -7,8 +7,6 @@ note | |||
| 7 | class | 7 | class |
| 8 | ACCOUNT | 8 | ACCOUNT |
| 9 | 9 | ||
| 10 | inherit | ||
| 11 | |||
| 12 | 10 | ||
| 13 | feature -- Access | 11 | feature -- Access |
| 14 | 12 | ||
diff --git a/bank-eiffel/bank.ecf b/bank-eiffel/bank.ecf index 8164c31..b3bf92c 100644 --- a/bank-eiffel/bank.ecf +++ b/bank-eiffel/bank.ecf | |||
| @@ -1,18 +1,23 @@ | |||
| 1 | <?xml version="1.0" encoding="ISO-8859-1"?> | 1 | <?xml version="1.0" encoding="ISO-8859-1"?> |
| 2 | <system xmlns="http://www.eiffel.com/developers/xml/configuration-1-5-0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://www.eiffel.com/developers/xml/configuration-1-5-0 http://www.eiffel.com/developers/xml/configuration-1-5-0.xsd" name="bank" uuid="ABD750A4-A528-4FEE-A7EA-37791A0D0F37"> | 2 | <system xmlns="http://www.eiffel.com/developers/xml/configuration-1-7-0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://www.eiffel.com/developers/xml/configuration-1-7-0 http://www.eiffel.com/developers/xml/configuration-1-7-0.xsd" name="bank" uuid="ABD750A4-A528-4FEE-A7EA-37791A0D0F37"> |
| 3 | <target name="bank"> | 3 | <target name="bank"> |
| 4 | <root feature="make" class="APPLICATION"/> | 4 | <description>FOOP Exercise #3</description> |
| 5 | <option warning="true"> | 5 | <root class="APPLICATION" feature="make"/> |
| 6 | <version major="0" minor="1" release="0" build="0" product="bank"/> | ||
| 7 | <option warning="true" void_safety="none"> | ||
| 6 | <assertions precondition="true" postcondition="true" check="true" invariant="true" loop="true" supplier_precondition="true"/> | 8 | <assertions precondition="true" postcondition="true" check="true" invariant="true" loop="true" supplier_precondition="true"/> |
| 7 | </option> | 9 | </option> |
| 8 | <precompile name="base_pre" location="$ISE_PRECOMP/base.ecf"/> | 10 | <setting name="executable_name" value="bank"/> |
| 9 | <library name="base" location="$ISE_LIBRARY/library/base/base.ecf"/> | 11 | <precompile name="base_pre" location="$ISE_PRECOMP\base.ecf"/> |
| 12 | <library name="base" location="$ISE_LIBRARY\library\base\base.ecf"/> | ||
| 13 | <library name="testing" location="$ISE_LIBRARY\library\testing\testing.ecf"/> | ||
| 10 | <cluster name="bank" location=".\" recursive="true"> | 14 | <cluster name="bank" location=".\" recursive="true"> |
| 11 | <file_rule> | 15 | <file_rule> |
| 12 | <exclude>/EIFGENs$</exclude> | 16 | <exclude>/EIFGENs$</exclude> |
| 13 | <exclude>/.svn$</exclude> | ||
| 14 | <exclude>/CVS$</exclude> | 17 | <exclude>/CVS$</exclude> |
| 18 | <exclude>/.svn$</exclude> | ||
| 15 | </file_rule> | 19 | </file_rule> |
| 20 | <tests name="tests" location="\home\manuel\uni\foop\bank-eiffel\tests\"/> | ||
| 16 | </cluster> | 21 | </cluster> |
| 17 | </target> | 22 | </target> |
| 18 | <target name="bank_dotnet" extends="bank"> | 23 | <target name="bank_dotnet" extends="bank"> |
diff --git a/bank-eiffel/person.e b/bank-eiffel/person.e index 5230362..93ce339 100644 --- a/bank-eiffel/person.e +++ b/bank-eiffel/person.e | |||
| @@ -7,11 +7,14 @@ note | |||
| 7 | class | 7 | class |
| 8 | PERSON | 8 | PERSON |
| 9 | 9 | ||
| 10 | feature -- Access | 10 | create |
| 11 | make | ||
| 11 | 12 | ||
| 12 | surename: STRING_8 | 13 | feature {NONE} -- Initialization |
| 14 | |||
| 15 | surname: STRING_8 | ||
| 13 | -- Nachname | 16 | -- Nachname |
| 14 | attribute Result := ({like surename}).default end --| Remove line when Void Safety is properly set | 17 | attribute Result := ({like surname}).default end --| Remove line when Void Safety is properly set |
| 15 | 18 | ||
| 16 | firstname: STRING_8 assign set_firstname | 19 | firstname: STRING_8 assign set_firstname |
| 17 | -- Vorname | 20 | -- Vorname |
| @@ -19,14 +22,20 @@ feature -- Access | |||
| 19 | 22 | ||
| 20 | feature -- Element change | 23 | feature -- Element change |
| 21 | 24 | ||
| 22 | set_surename (a_surename: like surename) | 25 | make (a_surname: like surname; a_firstname: like firstname) |
| 23 | -- Assign `surename' with `a_surename'. | 26 | do |
| 27 | set_surname (a_surname) | ||
| 28 | set_firstname (a_firstname) | ||
| 29 | end | ||
| 30 | |||
| 31 | set_surname (a_surname: like surname) | ||
| 32 | -- Assign `surname' with `a_surname'. | ||
| 24 | require | 33 | require |
| 25 | a_surename_not_empty: a_surename /= Void and then not a_surename.is_empty | 34 | a_surname_not_empty: a_surname /= Void and then not a_surname.is_empty |
| 26 | do | 35 | do |
| 27 | surename := a_surename | 36 | surname := a_surname |
| 28 | ensure | 37 | ensure |
| 29 | surename_assigned: surename = a_surename | 38 | surname_assigned: surname = a_surname |
| 30 | end | 39 | end |
| 31 | 40 | ||
| 32 | set_firstname (a_firstname: like firstname) | 41 | set_firstname (a_firstname: like firstname) |
| @@ -41,5 +50,5 @@ feature -- Element change | |||
| 41 | 50 | ||
| 42 | invariant | 51 | invariant |
| 43 | firstname_not_empty: firstname /= Void and then not firstname.is_empty | 52 | firstname_not_empty: firstname /= Void and then not firstname.is_empty |
| 44 | surename_not_empty: surename /= Void and then not surename.is_empty | 53 | surname_not_empty: surname /= Void and then not surname.is_empty |
| 45 | end | 54 | end |
diff --git a/bank-eiffel/tests/test_account.e b/bank-eiffel/tests/test_account.e new file mode 100644 index 0000000..1820c45 --- /dev/null +++ b/bank-eiffel/tests/test_account.e | |||
| @@ -0,0 +1,30 @@ | |||
| 1 | note | ||
| 2 | description: "[ | ||
| 3 | Eiffel tests that can be executed by testing tool. | ||
| 4 | ]" | ||
| 5 | author: "EiffelStudio test wizard" | ||
| 6 | date: "$Date$" | ||
| 7 | revision: "$Revision$" | ||
| 8 | testing: "type/manual" | ||
| 9 | |||
| 10 | class | ||
| 11 | TEST_ACCOUNT | ||
| 12 | |||
| 13 | inherit | ||
| 14 | EQA_TEST_SET | ||
| 15 | |||
| 16 | feature -- Test routines | ||
| 17 | |||
| 18 | CREATE_ACCOUNT | ||
| 19 | -- New test routine | ||
| 20 | local | ||
| 21 | person1: PERSON | ||
| 22 | account: ACCOUNT | ||
| 23 | do | ||
| 24 | create person1.make ("VORNAME", "NACHNAME") | ||
| 25 | --assert ("not_implemented", False) | ||
| 26 | end | ||
| 27 | |||
| 28 | end | ||
| 29 | |||
| 30 | |||
diff --git a/bank-eiffel/tests/test_person.e b/bank-eiffel/tests/test_person.e new file mode 100644 index 0000000..f23df03 --- /dev/null +++ b/bank-eiffel/tests/test_person.e | |||
| @@ -0,0 +1,60 @@ | |||
| 1 | note | ||
| 2 | description: "[ | ||
| 3 | Eiffel tests that can be executed by testing tool. | ||
| 4 | ]" | ||
| 5 | author: "EiffelStudio test wizard" | ||
| 6 | date: "$Date$" | ||
| 7 | revision: "$Revision$" | ||
| 8 | testing: "type/manual" | ||
| 9 | |||
| 10 | class | ||
| 11 | TEST_PERSON | ||
| 12 | |||
| 13 | inherit | ||
| 14 | EQA_TEST_SET | ||
| 15 | |||
| 16 | feature -- Test routines | ||
| 17 | |||
| 18 | CREATE_PERSON | ||
| 19 | local | ||
| 20 | person: PERSON | ||
| 21 | do | ||
| 22 | create person.make("SOME_SURNAME", "SOME_FIRSTNAME") | ||
| 23 | end | ||
| 24 | |||
| 25 | CREATE_PERSON_NO_SURNAME | ||
| 26 | local | ||
| 27 | person: PERSON | ||
| 28 | retried: BOOLEAN | ||
| 29 | do | ||
| 30 | if not retried then | ||
| 31 | create person.make("", "SOME_FIRSTNAME") | ||
| 32 | retried := True | ||
| 33 | assert("CREATE_PERSON_NO_SURNAME", False) | ||
| 34 | end | ||
| 35 | rescue | ||
| 36 | if not retried then | ||
| 37 | retried := True | ||
| 38 | retry | ||
| 39 | end | ||
| 40 | end | ||
| 41 | |||
| 42 | CREATE_PERSON_NO_FIRSTNAME | ||
| 43 | local | ||
| 44 | person: PERSON | ||
| 45 | retried: BOOLEAN | ||
| 46 | do | ||
| 47 | if not retried then | ||
| 48 | create person.make("SOME_SURNAME", "") | ||
| 49 | retried := True | ||
| 50 | assert("CREATE_PERSON_NO_FIRSTNAME", False) | ||
| 51 | end | ||
| 52 | rescue | ||
| 53 | if not retried then | ||
| 54 | retried := True | ||
| 55 | retry | ||
| 56 | end | ||
| 57 | end | ||
| 58 | end | ||
| 59 | |||
| 60 | |||
