home *** CD-ROM | disk | FTP | other *** search
- -- Part of SmallEiffel -- Read DISCLAIMER file -- Copyright (C)
- -- Dominique COLNET and Suzanne COLLIN -- colnet@loria.fr
- --
- class TEST_STRING2
-
- creation {ANY}
- make
-
- feature {ANY}
-
- make is
- local
- s1, s2: STRING;
- do
- !!s1.copy("kiki");
- is_true(equal(s1,"kiki"));
-
- !!s2.copy(s1);
- is_true(s1 /= s2);
- is_true(s1.is_equal(s2));
-
- s1 := s2;
- !!s2.copy(s2);
- is_true(s1 /= s2);
- is_true(s1.is_equal(s2));
-
- !!s1.make(25);
- is_true(s1.capacity >= 25);
- is_true(s1.count = 0);
-
- !!s1.blank(25);
- is_true(s1.capacity >= 25);
- is_true(s1.occurrences_of(' ') = 25);
- is_true(s1.count = 25);
-
- !!s1.make(1);
- is_true(s1.capacity >= 1);
- is_true(s1.count = 0);
- s1.extend('x');
- is_true(s1.count = 1);
-
- s1 := "foo.c";
- s1.remove_suffix(".c");
- is_true(s1.is_equal("foo"));
-
- is_true(("foo bar").has_prefix("foo"));
- is_true(("foo bar").has_prefix(""));
- is_true(("foo bar").has_suffix(""));
- is_true(not ("foo").has_prefix("foo bar"));
- is_true(not ("foo bar").has_prefix(" foo"));
- end;
-
- is_true(b: BOOLEAN) is
- do
- cpt := cpt + 1;
- if not b then
- std_output.put_string("TEST_STRING2: ERROR Test # ");
- std_output.put_integer(cpt);
- std_output.put_string("%N");
- else
- -- std_output.put_string("Yes %N");
- end;
- end;
-
- cpt: INTEGER;
-
- end -- TEST_STRING2
-