Debian Codegraph @

gcc/testsuite/gm2/builtins/run/pass/testisnormal.mod

raw
1 IMPLEMENTATION MODULE testisnormal ;
2
3 FROM libc IMPORT printf, exit ;
4 FROM Builtins IMPORT isnormal ;
5 FROM SYSTEM IMPORT ADR ;
6
7
8 (*
9 assert -
10 *)
11
12 PROCEDURE assert (value: BOOLEAN; message: ARRAY OF CHAR) ;
13 BEGIN
14 IF NOT value
15 THEN
16 printf ("test failed: %s\n", ADR (message)) ;
17 code := 1
18 END
19 END assert ;
20
21
22
23 (*
24 test -
25 *)
26
27 PROCEDURE test ;
28 VAR
29 result: INTEGER ;
30 BEGIN
31 result := isnormal (1.0) ;
32 printf ("isnormal (1.0) = %d\n", result) ;
33 assert (result = 1, "isnormal (1.0) # 1")
34 END test ;
35
36
37 VAR
38 code: INTEGER ;
39 BEGIN
40 code := 0 ;
41 test ;
42 IF code = 0
43 THEN
44 printf ("all tests pass\n")
45 ELSE
46 printf ("some tests failed\n")
47 END ;
48 exit (code)
49 END testisnormal.