]> git.ipfire.org Git - thirdparty/gcc.git/blob - gcc/testsuite/gm2/isolib/run/pass/arraycons.mod
Merge modula-2 front end onto gcc.
[thirdparty/gcc.git] / gcc / testsuite / gm2 / isolib / run / pass / arraycons.mod
1 (* Copyright (C) 2009 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 arraycons ;
19
20 FROM StrIO IMPORT WriteString, WriteLn ;
21 FROM StrLib IMPORT StrEqual ;
22 FROM FIO IMPORT StdOut, FlushBuffer ;
23 FROM libc IMPORT exit ;
24
25 TYPE
26 tests = RECORD
27 i, o: ARRAY [0..maxString] OF CHAR ;
28 END ;
29 sigfigArray = ARRAY [0..1] OF tests ;
30
31 CONST
32 maxString = 80 ;
33
34 VAR
35 a: sigfigArray ;
36 e: INTEGER ;
37 BEGIN
38 a := sigfigArray{tests{ "12" , "34"},
39 tests{ "56" , "78"}} ;
40 e := 0 ;
41 WITH a[0] DO
42 WriteString(i) ;
43 WriteString(' ') ;
44 WriteString(o) ;
45 WriteLn ;
46 IF NOT StrEqual(i, "12")
47 THEN
48 e := 1
49 END ;
50 IF NOT StrEqual(o, "34")
51 THEN
52 e := 2
53 END
54 END ;
55 WriteLn ;
56 WITH a[1] DO
57 WriteString(i) ;
58 WriteString(' ') ;
59 WriteString(o) ;
60 WriteLn ;
61 IF NOT StrEqual(i, "56")
62 THEN
63 e := 3
64 END ;
65 IF NOT StrEqual(o, "78")
66 THEN
67 e := 4
68 END
69 END ;
70 WriteLn ;
71 FlushBuffer(StdOut) ;
72 exit(e)
73 END arraycons.