/test/lib/storage/collection/test_remove_first1.e
Specman e | 73 lines | 45 code | 6 blank | 22 comment | 1 complexity | 5a571c0f4d0c0c215423ca660cc82a44 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_REMOVE_FIRST1 5 6create {} 7 make 8 9feature {ANY} 10 make 11 local 12 a: ARRAY[INTEGER]; fa: FAST_ARRAY[INTEGER]; ll: LINKED_LIST[INTEGER]; l2l: TWO_WAY_LINKED_LIST[INTEGER] 13 do 14 a := {ARRAY[INTEGER] 1, << 1, 2, 3 >> } 15 test(a) 16 fa := {FAST_ARRAY[INTEGER] << 1, 2, 3 >> } 17 test(fa) 18 ll := {LINKED_LIST[INTEGER] << 1, 2, 3 >> } 19 test(ll) 20 l2l := {TWO_WAY_LINKED_LIST[INTEGER] << 1, 2, 3 >> } 21 test(l2l) 22 end 23 24feature {} 25 test (c: COLLECTION[INTEGER]) 26 do 27 assert(c.count = 3) 28 assert(c.first = 1) 29 c.remove_first 30 assert(c.count = 2) 31 assert(c.first = 2) 32 c.remove_first 33 assert(c.first = 3) 34 assert(c.count = 1) 35 c.remove_first 36 assert(c.count = 0) 37 assert(c.is_empty) 38 end 39 40 assert (b: BOOLEAN) 41 do 42 cpt := cpt + 1 43 if not b then 44 std_output.put_string("TEST_REMOVE_FIRST1: ERROR Test # ") 45 std_output.put_integer(cpt) 46 std_output.put_string("%N") 47 crash 48 else 49 -- std_output.put_string("Yes%N"); 50 end 51 end 52 53 cpt: INTEGER 54 55end -- class TEST_REMOVE_FIRST1 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-- ------------------------------------------------------------------------------------------------------------------------------