Debian Codegraph @

gcc/testsuite/gm2/iso/run/pass/tsize.mod

raw
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 tsize ;
19
20 FROM libc IMPORT exit ;
21 FROM SYSTEM IMPORT TSIZE ;
22
23 TYPE
24 t1 = RECORD
25 CASE tag: CARDINAL OF
26 ||| 0 : v1 : CHAR;
27 | 1 : v2 : INTEGER;
28 ELSE
29 END
30 END ;
31
32 t2 = RECORD
33 CASE atag: CARDINAL OF
34 ||| 0 : v1 : CARDINAL;
35 | 1 : v2 : CHAR;
36 ELSE
37 END
38 END ;
39
40
41 BEGIN
42 (* incorrect test code commented out
43 IF TSIZE(t1, 0)#SIZE(CHAR)
44 THEN
45 exit(1)
46 END ;
47 IF TSIZE(t1, 1)#SIZE(INTEGER)
48 THEN
49 exit(1)
50 END ;
51 IF TSIZE(t2, 0)#SIZE(CARDINAL)
52 THEN
53 exit(1)
54 END ;
55 IF TSIZE(t2, 1)#SIZE(CHAR)
56 THEN
57 exit(1)
58 END
59 *)
60 END tsize.