/test/lib/string/test_string2.e
Specman e | 66 lines | 41 code | 4 blank | 21 comment | 0 complexity | 544df4046ea744f1deed58c02025a6bc 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_STRING2 5 6insert 7 EIFFELTEST_TOOLS 8 9create {} 10 make 11 12feature {ANY} 13 make 14 local 15 s1, s2: STRING 16 do 17 create s1.copy("kiki") 18 assert(s1.is_equal("kiki")) 19 create s2.copy(s1) 20 assert(s1 /= s2) 21 assert(s1.is_equal(s2)) 22 s1 := s2 23 create s2.copy(s2) 24 assert(s1 /= s2) 25 assert(s1.is_equal(s2)) 26 create s1.make(25) 27 assert(s1.capacity >= 25) 28 assert(s1.count = 0) 29 create s1.make_filled(' ', 25) 30 assert(s1.capacity >= 25) 31 assert(s1.occurrences(' ') = 25) 32 assert(s1.count = 25) 33 create s1.make(1) 34 assert(s1.capacity >= 1) 35 assert(s1.count = 0) 36 s1.extend('x') 37 assert(s1.count = 1) 38 s1 := "foo.c" 39 s1.remove_suffix(".c") 40 assert(s1.is_equal("foo")) 41 assert(("foo bar").has_prefix("foo")) 42 assert(("foo bar").has_prefix("")) 43 assert(("foo bar").has_suffix("")) 44 assert(not ("foo").has_prefix("foo bar")) 45 assert(not ("foo bar").has_prefix(" foo")) 46 end 47 48end -- class TEST_STRING2 49-- 50-- ------------------------------------------------------------------------------------------------------------------------------ 51-- Copyright notice below. Please read. 52-- 53-- SmartEiffel is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License, 54-- as published by the Free Software Foundation; either version 2, or (at your option) any later version. 55-- SmartEiffel is distributed in the hope that it will be useful but WITHOUT ANY WARRANTY; without even the implied warranty 56-- of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details. You should have 57-- received a copy of the GNU General Public License along with SmartEiffel; see the file COPYING. If not, write to the Free 58-- Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA. 59-- 60-- Copyright(C) 1994-2002: INRIA - LORIA (INRIA Lorraine) - ESIAL U.H.P. - University of Nancy 1 - FRANCE 61-- Copyright(C) 2003-2006: INRIA - LORIA (INRIA Lorraine) - I.U.T. Charlemagne - University of Nancy 2 - FRANCE 62-- 63-- Authors: Dominique COLNET, Philippe RIBET, Cyril ADRIAN, Vincent CROIZIER, Frederic MERIZEN 64-- 65-- http://SmartEiffel.loria.fr - SmartEiffel@loria.fr 66-- ------------------------------------------------------------------------------------------------------------------------------