aboutsummaryrefslogtreecommitdiff
path: root/gcc/testsuite/gm2/builtins/run/pass/testisnormal.mod
blob: 1349d80e8e8eb04df6930e7fde8bb0079e6614e5 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
IMPLEMENTATION MODULE testisnormal ;

FROM libc IMPORT printf, exit ;
FROM Builtins IMPORT isnormal ;
FROM SYSTEM IMPORT ADR ;


(*
   assert -
*)

PROCEDURE assert (value: BOOLEAN; message: ARRAY OF CHAR) ;
BEGIN
   IF NOT value
   THEN
      printf ("test failed: %s\n", ADR (message)) ;
      code := 1
   END
END assert ;



(*
   test -
*)

PROCEDURE test ;
VAR
   result: INTEGER ;
BEGIN
   result := isnormal (1.0) ;
   printf ("isnormal (1.0) = %d\n", result) ;
   assert (result = 1, "isnormal (1.0) # 1")
END test ;


VAR
   code: INTEGER ;
BEGIN
   code := 0 ;
   test ;
   IF code = 0
   THEN
      printf ("all tests pass\n")
   ELSE
      printf ("some tests failed\n")
   END ;
   exit (code)
END testisnormal.