~ubuntu-branches/ubuntu/raring/adacontrol/raring

« back to all changes in this revision

Viewing changes to test/t_expressions-test_real_equality.adb

  • Committer: Bazaar Package Importer
  • Author(s): Ludovic Brenta
  • Date: 2010-03-13 14:01:37 UTC
  • mfrom: (1.1.5 upstream) (9.1.1 sid)
  • Revision ID: james.westby@ubuntu.com-20100313140137-50ia1bbb5qld97fd
Tags: 1.12~b1-1
New upstream beta version.  Really closes: #566061 even on i386.

Show diffs side-by-side

added added

removed removed

Lines of Context:
9
9
   type D is delta 0.1 digits 15;
10
10
   subtype SD is D digits 10;
11
11
 
12
 
   VA1, VA2 : A := 0.0;
13
 
   VB1, VB2 : B := 0.0;
 
12
   VA1,  VA2  : A  := 0.0;
 
13
   VB1,  VB2  : B  := 0.0;
14
14
   VSB1, VSB2 : SB := 0.0;
15
 
   VC1, VC2 : C := 0.0;
16
 
   VD1, VD2 : D := 0.0;
 
15
   VC1,  VC2  : C  := 0.0;
 
16
   VD1,  VD2  : D  := 0.0;
17
17
   VSD1, VSD2 : SD := 0.0;
18
 
   F : Float := 0.0;
 
18
   VFloat     : Float := 0.0;
19
19
 
20
20
   function X return A is
21
21
   begin
37
37
      return Float (0.0);     -- type_conversion
38
38
   end X;
39
39
 
 
40
   -- Renaming of "="
 
41
   function Equal (L, R : A) return Boolean renames "=";
 
42
 
 
43
   -- Redefinition of "="
 
44
   type E is new Float;
 
45
   function "=" (A, B : E) return Boolean is
 
46
   begin
 
47
      return abs (A - B) < 0.01;
 
48
   end "=";
 
49
 
 
50
   VE1, VE2 : E;
 
51
 
 
52
   type DE is new E;
 
53
   VDE1, VDE2 : DE;
 
54
 
40
55
begin
41
56
 
42
57
   if VA1 = VA2 then               -- real_equality
67
82
      null;
68
83
   elsif VSD1 /= SD (0.0) then     -- real_equality, type_conversion
69
84
      null;
70
 
   elsif F /= X then               -- real_equality
 
85
   elsif VFloat /= X then          -- real_equality
71
86
      null;
72
87
   elsif 0.0 = 1.0 then            -- real_equality
73
88
      null;
74
89
   end if;
 
90
 
 
91
   if Equal (VA1, VA2) then        -- real_equality
 
92
      null;
 
93
   end if;
 
94
 
 
95
   if VE1 = 1.0 then               -- OK
 
96
      null;
 
97
   elsif VE1 = VE2 then            -- OK
 
98
      null;
 
99
   elsif VE2 /= 0.0 then           -- OK
 
100
      null;
 
101
   elsif VE2 /= VE1 then           -- OK
 
102
      null;
 
103
   end if;
 
104
 
 
105
   if VDE1 = 1.0 then              -- Inherited_Function_Call
 
106
      null;
 
107
   elsif VDE1 = VDE2 then          -- Inherited_Function_Call
 
108
      null;
 
109
   elsif VDE2 /= 0.0 then          -- OK
 
110
      null;
 
111
   elsif VDE2 /= VDE1 then         -- OK
 
112
      null;
 
113
   end if;
 
114
 
75
115
end Test_Real_Equality;