/test/language/unclassified/test_inherit1.e

http://github.com/tybor/Liberty · Specman e · 78 lines · 50 code · 5 blank · 23 comment · 1 complexity · 2188c2bd83093d6353c1ae9253931015 MD5 · raw file

  1. -- This file is part of SmartEiffel The GNU Eiffel Compiler Tools and Libraries.
  2. -- See the Copyright notice at the end of this file.
  3. --
  4. class TEST_INHERIT1
  5. -- From a bug report of Philippe REITZ
  6. create {}
  7. make
  8. feature {ANY}
  9. make
  10. local
  11. oa: AUX_INHERIT1A; ob: AUX_INHERIT1B; oc: AUX_INHERIT1C; t: ARRAY[AUX_INHERIT1A]
  12. do
  13. create oa
  14. create ob
  15. create oc
  16. t := {ARRAY[AUX_INHERIT1A] 1, << oa, ob, oc >> }
  17. oa := t.item(1)
  18. assert(oa.a_count = 0)
  19. assert(oa.b_count = 0)
  20. assert(oa.c_count = 0)
  21. oa.fonc
  22. assert(oa.a_count = 1)
  23. assert(oa.b_count = 0)
  24. assert(oa.c_count = 0)
  25. oa := t.item(2)
  26. assert(oa.a_count = 0)
  27. assert(oa.b_count = 0)
  28. assert(oa.c_count = 0)
  29. oa.fonc
  30. assert(oa.a_count = 1)
  31. assert(oa.b_count = 1)
  32. assert(oa.c_count = 0)
  33. oa := t.item(3)
  34. assert(oa.a_count = 0)
  35. assert(oa.b_count = 0)
  36. assert(oa.c_count = 0)
  37. oa.fonc
  38. assert(oa.a_count = 1)
  39. assert(oa.b_count = 0)
  40. assert(oa.c_count = 1)
  41. end
  42. feature {}
  43. assert (b: BOOLEAN)
  44. do
  45. cpt := cpt + 1
  46. if not b then
  47. std_output.put_string("TEST_INHERIT1: ERROR Test # ")
  48. std_output.put_integer(cpt)
  49. std_output.put_string("%N")
  50. else
  51. -- std_output.put_string("Yes%N");
  52. end
  53. end
  54. cpt: INTEGER
  55. end -- class TEST_INHERIT1
  56. --
  57. -- ------------------------------------------------------------------------------------------------------------------------------
  58. -- Copyright notice below. Please read.
  59. --
  60. -- SmartEiffel is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License,
  61. -- as published by the Free Software Foundation; either version 2, or (at your option) any later version.
  62. -- SmartEiffel is distributed in the hope that it will be useful but WITHOUT ANY WARRANTY; without even the implied warranty
  63. -- of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details. You should have
  64. -- received a copy of the GNU General Public License along with SmartEiffel; see the file COPYING. If not, write to the Free
  65. -- Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA.
  66. --
  67. -- Copyright(C) 1994-2002: INRIA - LORIA (INRIA Lorraine) - ESIAL U.H.P. - University of Nancy 1 - FRANCE
  68. -- Copyright(C) 2003-2006: INRIA - LORIA (INRIA Lorraine) - I.U.T. Charlemagne - University of Nancy 2 - FRANCE
  69. --
  70. -- Authors: Dominique COLNET, Philippe RIBET, Cyril ADRIAN, Vincent CROIZIER, Frederic MERIZEN
  71. --
  72. -- http://SmartEiffel.loria.fr - SmartEiffel@loria.fr
  73. -- ------------------------------------------------------------------------------------------------------------------------------