CVS difference for acats/new/c350a01.a

Differences between 1.1 and version 1.2
Log of other versions for file acats/new/c350a01.a

--- acats/new/c350a01.a	2020/07/01 02:07:39	1.1
+++ acats/new/c350a01.a	2020/07/01 04:17:49	1.2
@@ -46,12 +46,12 @@
 --    We also test that default values out of range raise Constraint_Error.
 --
 -- CHANGE HISTORY:
--- ed test.
+--    29 Jun 2020 RLB Created test for RRS, donated to ACATS.
 
 with Report, F350A00;
 procedure C350A01 is
 
-   use Report, F350A00;
+    use Report, F350A00;
 
     type My_Rec is record
         Kind : F350A00.Status;
@@ -63,29 +63,38 @@
         Cnt : F350A00.Small_Natural;
             -- Default initialization out of range
     end record;
-  
+
     type Status_Array  is array (1 .. 5) of F350A00.Status;
     type Sml_Int_Array is array (1 .. 5) of F350A00.Small_Integer;
     type Word_Array    is array (1 .. 5) of F350A00.Word_16;
 
-    function Ident_SInt (X : in F350A00.Small_Integer) 
+    function Ident_SInt (X : in F350A00.Small_Integer)
         return F350A00.Small_Integer is
         -- Force a dynamic value.
     begin
         return F350A00.Small_Integer(Report.Ident_Int(Integer(X)));
     end Ident_SInt;
-    
+
     function Ident_Status (X : in F350A00.Status) return F350A00.Status is
         -- Force a dynamic value.
     begin
         return F350A00.Status'Val(Report.Ident_Int(F350A00.Status'Pos(X)));
     end Ident_Status;
-    
-    -- Note: We can't safely write a Ident_Word as the range of Integer
-    -- might not include Word_16'Last, and writing one of these routines
-    -- without using the optimization breaker routines from Report may not
-    -- have the intended effect because of automatic inlining.
-    
+
+    function Ident_Word (X : in F350A00.Word_16)
+        return F350A00.Word_16 is
+        -- Force a dynamic value.
+    begin
+        if Equal (Ident_Int(1), 1) then
+            return X;
+        else
+            return 0;
+        end if;
+    end Ident_Word;
+
+    -- Note: We can't safely write a Ident_Word that directly uses Ident_Int
+    -- as the range of Integer might not include Word_16'Last.
+
  begin
     Test ("C350A01", "Check that objects of types with a specified " &
                      "Default_Value are appropriately initialized. " &
@@ -97,10 +106,10 @@
         A_Kind : F350A00.Status; -- Default initialized.
         B_Kind : F350A00.Status := Raw;
         An_Int : F350A00.Small_Integer; -- Default initialized.
-        Bn_Int : F350A00.Small_Integer := 0; 
-        Cn_Int : F350A00.Small_Natural := 1; 
+        Bn_Int : F350A00.Small_Integer := 0;
+        Cn_Int : F350A00.Small_Natural := 1;
         A_Word : F350A00.Word_16; -- Default initialized.
-        B_Word : F350A00.Word_16 := 16#FFFF#; 
+        B_Word : F350A00.Word_16 := 16#FFFF#;
     begin
         if A_Kind /= Ident_Status(Unknown) then
             Failed ("Bad default initialization of stand alone object of " &
@@ -122,11 +131,11 @@
             Failed ("Bad explicit initialization of stand alone object of " &
                     "an integer subtype");
         end if;
-        if A_Word /= 16#DEAD# then
+        if A_Word /= Ident_Word(16#DEAD#) then
             Failed ("Bad default initialization of stand alone object of " &
                     "a modular type");
         end if;
-        if B_Word /= 16#FFFF# then
+        if B_Word /= Ident_Word(16#FFFF#) then
             Failed ("Bad explicit initialization of stand alone object of " &
                     "a modular type");
         end if;
@@ -142,7 +151,7 @@
         end;
     exception
         when Constraint_Error => null; -- Expected exception.
-    end;     
+    end;
     --------------------------------------------------
     -- (B) Default initialized components:
     declare
@@ -159,7 +168,7 @@
             Failed ("Bad default initialization of record component of " &
                     "an integer type");
         end if;
-        if A_Rec.Cnt /= 16#DEAD# then
+        if A_Rec.Cnt /= Ident_Word(16#DEAD#) then
             Failed ("Bad default initialization of record component of " &
                     "a modular type");
         end if;
@@ -187,8 +196,8 @@
         end;
     exception
         when Constraint_Error => null; -- Expected exception.
-    end;     
-   
+    end;
+
     --------------------------------------------------
     -- (C) <> initialization in array and record aggregates:
     declare
@@ -204,17 +213,17 @@
             Failed ("Bad default initialization of aggregate record " &
                     "component of an enumeration type");
         end if;
-        if B_Rec /= (Kind => Ident_Status(Raw), 
+        if B_Rec /= (Kind => Ident_Status(Raw),
                      Num  => Ident_SInt(Unused), Cnt => 0) then
             Failed ("Bad default initialization of aggregate record " &
                     "component of an integer type");
         end if;
-        if C_Rec /= (Kind => Ident_Status(Raw), 
+        if C_Rec /= (Kind => Ident_Status(Raw),
                      Num  => Ident_SInt(12), Cnt => 16#DEAD#) then
             Failed ("Bad default initialization of aggregate record " &
                     "component of a modular type");
         end if;
-        if A_Arr /= (1 => Ident_Status(Solved), 
+        if A_Arr /= (1 => Ident_Status(Solved),
                      2 .. 5 => Ident_Status(Unknown)) then
             Failed ("Bad default initialization of aggregate array " &
                     "component of an enumeration type");
@@ -223,7 +232,7 @@
             Failed ("Bad default initialization of aggregate array " &
                     "component of an integer type");
         end if;
-        if C_Arr /= (2 => 0, 4 => 52, 1 | 3 | 5 => 16#DEAD#) then
+        if C_Arr /= (2 => 0, 4 => 52, 1 | 3 | 5 => Ident_Word(16#DEAD#)) then
             Failed ("Bad default initialization of aggregate array " &
                     "component of a modular type");
         end if;
@@ -235,13 +244,13 @@
                 -- Default initialization out of range
         begin
             Failed ("Default initialization of an aggregate record " &
-                    "component of an integer subtype did not raise " & 
+                    "component of an integer subtype did not raise " &
                     "Constraint_Error");
         end;
     exception
         when Constraint_Error => null; -- Expected exception.
-    end;     
-      
+    end;
+
     --------------------------------------------------
     -- (D) Allocators:
     --------------------------------------------------
@@ -250,14 +259,14 @@
         E_Ptr : Enum_Access := new F350A00.Status; -- Default initialized.
 
         type Int_Access is access F350A00.Small_Integer;
-        I_Ptr : Int_Access := new F350A00.Small_Integer; -- Default initialized.
-        
+        I_Ptr : Int_Access := new F350A00.Small_Integer;-- Default initialized.
+
         type Mod_Access is access F350A00.Word_16;
         M_Ptr : Mod_Access := new F350A00.Word_16; -- Default initialized.
-        
+
         type Rec_Access is access My_Rec;
         R_Ptr : Rec_Access := new My_Rec; -- Default initialized.
-        
+
         type Arr_Access is access Status_Array;
         A_Ptr : Arr_Access := new Status_Array; -- Default initialized.
     begin
@@ -269,11 +278,11 @@
             Failed ("Bad default initialization of allocator of " &
                     "an integer type");
         end if;
-        if M_Ptr.all /= 16#DEAD# then
+        if M_Ptr.all /= Ident_Word(16#DEAD#) then
             Failed ("Bad default initialization of allocator of " &
                     "a modular type");
         end if;
-        if R_Ptr.Kind /= Unknown then
+        if R_Ptr.Kind /= Ident_Status(Unknown) then
             Failed ("Bad default initialization of record component of " &
                     "allocator of an enumeration type");
         end if;
@@ -281,7 +290,7 @@
             Failed ("Bad default initialization of record component of " &
                     "allocator of an integer type");
         end if;
-        if R_Ptr.Cnt /= 16#DEAD# then
+        if R_Ptr.Cnt /= Ident_Word(16#DEAD#) then
             Failed ("Bad default initialization of record component of " &
                     "allocator of a modular type");
         end if;

Questions? Ask the ACAA Technical Agent