Debian Codegraph @

gcc/testsuite/gm2/dynamic/pass/teststr.mod

raw
1 (* Copyright (C) 2001, 2002, 2003, 2004, 2005, 2006 Free Software Foundation, Inc. *)
2 (* This file is part of GNU Modula-2.
3
4 GNU Modula-2 is free software; you can redistribute it and/or modify it under
5 the terms of the GNU General Public License as published by the Free
6 Software Foundation; either version 2, or (at your option) any later
7 version.
8
9 GNU Modula-2 is distributed in the hope that it will be useful, but WITHOUT ANY
10 WARRANTY; without even the implied warranty of MERCHANTABILITY or
11 FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
12 for more details.
13
14 You should have received a copy of the GNU General Public License along
15 with gm2; see the file COPYING. If not, write to the Free Software
16 Foundation, 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. *)
17
18 MODULE teststr ;
19
20 FROM StrIO IMPORT WriteString, WriteLn ;
21 FROM StrLib IMPORT StrCopy, StrConCat, StrLen, StrEqual ;
22 FROM NumberIO IMPORT WriteCard ;
23
24 PROCEDURE foo (b: ARRAY OF CHAR) ;
25 BEGIN
26 StrCopy(b, a)
27 END foo ;
28
29 VAR
30 a: ARRAY [0..50] OF CHAR ;
31 BEGIN
32 foo('hello') ;
33 WriteString('hello world') ; WriteLn ;
34 StrCopy('hello gaius', a) ; WriteString(a) ; WriteLn ;
35 StrCopy('2', a) ; WriteString(a) ; WriteLn ;
36 StrConCat('1', a, a) ; WriteString(a) ; WriteLn ;
37 StrConCat(a, a, a) ; WriteString(a) ; WriteLn ;
38 (* WriteString('length of a = ') ; WriteCard(StrLen(a), 10) ; WriteLn ; *)
39 IF StrEqual(a, '1212')
40 THEN
41 WriteString('yes')
42 ELSE
43 WriteString('no')
44 END ;
45 StrConCat(a, a, a) ; WriteString(a) ; WriteLn ;
46 IF StrEqual(a, '1212')
47 THEN
48 WriteString('yes')
49 ELSE
50 WriteString('no')
51 END ;
52 WriteLn ;
53 END teststr.