Debian Codegraph @

gcc/testsuite/gm2/complex/run/pass/arith7.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
5 it under the terms of the GNU General Public License as published by
6 the Free Software Foundation; either version 2, or (at your option)
7 any later version.
8
9 GNU Modula-2 is distributed in the hope that it will be useful, but
10 WITHOUT ANY WARRANTY; without even the implied warranty of
11 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
12 General Public License for more details.
13
14 You should have received a copy of the GNU General Public License
15 along with gm2; see the file COPYING. If not, write to the Free
16 Software Foundation, 51 Franklin Street, Fifth Floor, Boston, MA
17 02110-1301, USA. *)
18
19 MODULE arith7 ;
20
21 FROM libc IMPORT exit ;
22
23 PROCEDURE Assert (b: BOOLEAN) ;
24 BEGIN
25 INC(c) ;
26 IF NOT b
27 THEN
28 exit(c)
29 END
30 END Assert ;
31
32
33 CONST
34 one = CMPLX(1.0, 0.0) ;
35
36 VAR
37 z: COMPLEX ;
38 c: CARDINAL ;
39 BEGIN
40 c := 0 ;
41 z := CMPLX (0.0, -1.0) ;
42 Assert(z*z=-CMPLX(1.0, 0.0)) ;
43 Assert(z*z=-one)
44 END arith7.