PageRenderTime 46ms CodeModel.GetById 39ms app.highlight 2ms RepoModel.GetById 2ms app.codeStats 0ms

/test/language/unclassified/test_irf3.e

http://github.com/tybor/Liberty
Specman e | 120 lines | 82 code | 15 blank | 23 comment | 2 complexity | 3675e961c168c907533851203cede22a 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--
  4class TEST_IRF3
  5   -- Test inlining of RUN_FEATURE3.
  6
  7create {}
  8   make
  9
 10feature {ANY}
 11   att: INTEGER
 12
 13   make
 14      do
 15         set_attribute1(1 + 1)
 16         set_attribute2
 17         set_attribute3
 18         set_attribute4
 19         set_attribute5
 20         inline1
 21         inline2
 22         inline3
 23         inline4
 24      end
 25
 26feature {} -- All those feature are inlined in -boost mode :
 27   set_attribute1 (a: like att)
 28      do
 29         att := a
 30      end
 31
 32   set_attribute2
 33      do
 34         att := 4
 35      end
 36
 37   set_attribute3
 38      local
 39         i: INTEGER
 40      do
 41         att := i
 42      end
 43
 44   set_attribute4
 45      local
 46         i: INTEGER
 47      do
 48         att := i
 49      end
 50
 51   set_attribute5
 52      local
 53         i: INTEGER; j: INTEGER
 54      do
 55         att := i + j
 56      end
 57
 58   inline1
 59      do
 60      end
 61
 62   inline2
 63      local
 64         i: INTEGER; j: INTEGER
 65      do
 66         i := 1
 67         j := i + 1
 68      end
 69
 70   inline3
 71      do
 72         inline1
 73         inline2
 74      end
 75
 76feature {} -- Recursive call is not inlined :-)
 77   inline4
 78      local
 79         i: INTEGER
 80      do
 81         i := i + 1
 82         if i < 0 then
 83            inline4
 84         end
 85      end
 86
 87feature {}
 88   assert (b: BOOLEAN)
 89      do
 90         cpt := cpt + 1
 91         if not b then
 92            std_output.put_string("TEST_INTEGER1: ERROR Test # ")
 93            std_output.put_integer(cpt)
 94            std_output.put_string("%N")
 95         else
 96            -- std_output.put_string("Yes%N");
 97         end
 98      end
 99
100   cpt: INTEGER
101
102end -- class TEST_IRF3
103--
104-- ------------------------------------------------------------------------------------------------------------------------------
105-- Copyright notice below. Please read.
106--
107-- SmartEiffel is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License,
108-- as published by the Free Software Foundation; either version 2, or (at your option) any later version.
109-- SmartEiffel is distributed in the hope that it will be useful but WITHOUT ANY WARRANTY; without even the implied warranty
110-- of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details. You should have
111-- received a copy of the GNU General Public License along with SmartEiffel; see the file COPYING. If not, write to the Free
112-- Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA.
113--
114-- Copyright(C) 1994-2002: INRIA - LORIA (INRIA Lorraine) - ESIAL U.H.P.       - University of Nancy 1 - FRANCE
115-- Copyright(C) 2003-2006: INRIA - LORIA (INRIA Lorraine) - I.U.T. Charlemagne - University of Nancy 2 - FRANCE
116--
117-- Authors: Dominique COLNET, Philippe RIBET, Cyril ADRIAN, Vincent CROIZIER, Frederic MERIZEN
118--
119-- http://SmartEiffel.loria.fr - SmartEiffel@loria.fr
120-- ------------------------------------------------------------------------------------------------------------------------------