diff options
Diffstat (limited to 'eiffel-fragen/replaceability/test.e')
| -rw-r--r-- | eiffel-fragen/replaceability/test.e | 26 |
1 files changed, 26 insertions, 0 deletions
diff --git a/eiffel-fragen/replaceability/test.e b/eiffel-fragen/replaceability/test.e new file mode 100644 index 0000000..09a0821 --- /dev/null +++ b/eiffel-fragen/replaceability/test.e | |||
| @@ -0,0 +1,26 @@ | |||
| 1 | class | ||
| 2 | TEST | ||
| 3 | |||
| 4 | create | ||
| 5 | run | ||
| 6 | |||
| 7 | feature {NONE} -- Initialization | ||
| 8 | |||
| 9 | run | ||
| 10 | local | ||
| 11 | base: BASE | ||
| 12 | derived: DERIVED | ||
| 13 | derived2: DERIVED2 | ||
| 14 | ret: INTEGER | ||
| 15 | do | ||
| 16 | create base | ||
| 17 | create derived | ||
| 18 | create derived2 | ||
| 19 | |||
| 20 | ret := derived.add10(100) -- works | ||
| 21 | --ret := derived2.add10(100) -- fails due to stronger preconditions | ||
| 22 | |||
| 23 | --ret := derived.add10(10) -- fails due to precondition | ||
| 24 | ret := derived2.add10(10) -- works due to weaker preconditions | ||
| 25 | end | ||
| 26 | end | ||
