/test/language/unclassified/position/test_position5.e
Specman e | 72 lines | 42 code | 9 blank | 21 comment | 1 complexity | f5bfed132b571030189e66301b9220f6 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_POSITION5 5 6create {} 7 make 8 9feature {ANY} 10 p1: AUX_POSITION 11 12 current_class_id: INTEGER 13 14 aux: AUX_POSITION4 15 16 pos (l, c: INTEGER): AUX_POSITION 17 require 18 l >= 1 19 c >= 1 20 do 21 Result.set(l, c, current_class_id.to_integer_16) 22 end 23 24 make 25 local 26 str: STRING 27 do 28 str := "...." 29 current_class_id := 3 30 p1 := pos(1, 2) 31 assert(p1.line = 1) 32 assert(p1.column = 2) 33 assert(p1.id = 3) 34 p1 := pos(4, 5) 35 create aux.make(p1) 36 assert(aux.position.line = 4) 37 assert(aux.position.column = 5) 38 assert(aux.position.id = 3) 39 end 40 41 assert (b: BOOLEAN) 42 do 43 cpt := cpt + 1 44 if not b then 45 std_output.put_string("TEST_POSITION5: ERROR Test # ") 46 std_output.put_integer(cpt) 47 std_output.put_string("%N") 48 crash 49 end 50 end 51 52 cpt: INTEGER 53 54end -- class TEST_POSITION5 55-- 56-- ------------------------------------------------------------------------------------------------------------------------------ 57-- Copyright notice below. Please read. 58-- 59-- SmartEiffel is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License, 60-- as published by the Free Software Foundation; either version 2, or (at your option) any later version. 61-- SmartEiffel is distributed in the hope that it will be useful but WITHOUT ANY WARRANTY; without even the implied warranty 62-- of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details. You should have 63-- received a copy of the GNU General Public License along with SmartEiffel; see the file COPYING. If not, write to the Free 64-- Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA. 65-- 66-- Copyright(C) 1994-2002: INRIA - LORIA (INRIA Lorraine) - ESIAL U.H.P. - University of Nancy 1 - FRANCE 67-- Copyright(C) 2003-2006: INRIA - LORIA (INRIA Lorraine) - I.U.T. Charlemagne - University of Nancy 2 - FRANCE 68-- 69-- Authors: Dominique COLNET, Philippe RIBET, Cyril ADRIAN, Vincent CROIZIER, Frederic MERIZEN 70-- 71-- http://SmartEiffel.loria.fr - SmartEiffel@loria.fr 72-- ------------------------------------------------------------------------------------------------------------------------------