aboutsummaryrefslogtreecommitdiff
path: root/gcc/testsuite/ada/acats/tests/cc/cc51003.a
diff options
context:
space:
mode:
Diffstat (limited to 'gcc/testsuite/ada/acats/tests/cc/cc51003.a')
-rw-r--r--gcc/testsuite/ada/acats/tests/cc/cc51003.a187
1 files changed, 0 insertions, 187 deletions
diff --git a/gcc/testsuite/ada/acats/tests/cc/cc51003.a b/gcc/testsuite/ada/acats/tests/cc/cc51003.a
deleted file mode 100644
index 68ea32ebd78..00000000000
--- a/gcc/testsuite/ada/acats/tests/cc/cc51003.a
+++ /dev/null
@@ -1,187 +0,0 @@
--- CC51003.A
---
--- Grant of Unlimited Rights
---
--- Under contracts F33600-87-D-0337, F33600-84-D-0280, MDA903-79-C-0687,
--- F08630-91-C-0015, and DCA100-97-D-0025, the U.S. Government obtained
--- unlimited rights in the software and documentation contained herein.
--- Unlimited rights are defined in DFAR 252.227-7013(a)(19). By making
--- this public release, the Government intends to confer upon all
--- recipients unlimited rights equal to those held by the Government.
--- These rights include rights to use, duplicate, release or disclose the
--- released technical data and computer software in whole or in part, in
--- any manner and for any purpose whatsoever, and to have or permit others
--- to do so.
---
--- DISCLAIMER
---
--- ALL MATERIALS OR INFORMATION HEREIN RELEASED, MADE AVAILABLE OR
--- DISCLOSED ARE AS IS. THE GOVERNMENT MAKES NO EXPRESS OR IMPLIED
--- WARRANTY AS TO ANY MATTER WHATSOEVER, INCLUDING THE CONDITIONS OF THE
--- SOFTWARE, DOCUMENTATION OR OTHER INFORMATION RELEASED, MADE AVAILABLE
--- OR DISCLOSED, OR THE OWNERSHIP, MERCHANTABILITY, OR FITNESS FOR A
--- PARTICULAR PURPOSE OF SAID MATERIAL.
---*
---
--- OBJECTIVE:
--- Check that if the ancestor type of a formal derived type is a composite
--- type that is not an array type, the formal type inherits components,
--- including discriminants, from the ancestor type.
---
--- Check for the case where the ancestor type is a record type, and the
--- formal derived type is declared in a generic subprogram.
---
--- TEST DESCRIPTION:
--- Define a discriminated record type in a package. Declare a
--- library-level generic subprogram with a formal derived type using the
--- record type as ancestor. Give the generic subprogram an in out
--- parameter of the formal derived type. Inside the generic, use the
--- discriminant component and modify the remaining components of the
--- record parameter. In the main program, declare record objects with two
--- different discriminant values. Derive an indefinite type from the
--- record type with a new discriminant part. Instantiate the generic
--- subprogram for the root record subtype and the derived subtype. Call
--- the root subtype instance with actual parameters having the two
--- discriminant values. Also call the derived subtype instance with
--- an appropriate actual.
---
---
--- CHANGE HISTORY:
--- 06 Dec 94 SAIC ACVC 2.0
--- 03 Jan 95 SAIC Removed unknown discriminant part from formal
--- derived type.
--- 05 Nov 95 SAIC ACVC 2.0.1 fixes: Removed constrained subtype
--- instantiation and associated declarations.
--- Modified commentary.
---
---!
-
-
--- Simulate a fragment of a matrix manipulation application.
-
-package CC51003_0 is -- Matrix types.
-
- type Matrix is array (Natural range <>, Natural range <>) of Integer;
-
- type Square (Side : Natural) is record
- Mat : Matrix (1 .. Side, 1 .. Side);
- end record;
-
- type Double_Square (Number : Natural) is record
- Left : Square (Number);
- Right : Square (Number);
- end record;
-
-end CC51003_0;
-
-
--- No body for CC51003_0;
-
-
- --==================================================================--
-
-
-with CC51003_0; -- Matrix types.
-generic -- Generic double-matrix "clear" operation.
- type Dbl_Square is new CC51003_0.Double_Square; -- Indefinite
-procedure CC51003_1 (Dbl : in out Dbl_Square); -- formal.
-
-
- --==================================================================--
-
-
-procedure CC51003_1 (Dbl : in out Dbl_Square) is
-begin
- for I in 1 .. Dbl.Number loop -- Discriminants inherited from ancestor
- for J in 1 .. Dbl.Number loop -- type (should work even for derived type
- -- declaring new discriminant part).
- Dbl.Left.Mat (I, J) := 0; -- Other components inherited from
- Dbl.Right.Mat (I, J) := 0; -- ancestor type.
-
- end loop;
- end loop;
-end CC51003_1;
-
-
- --==================================================================--
-
-
-with CC51003_0; -- Matrix types.
-with CC51003_1; -- Generic double-matrix "clear" operation.
-
-with Report;
-procedure CC51003 is
-
- use CC51003_0; -- "/=" operator directly visible for Double_Square.
-
- -- Matrices of root type:
-
- Mat_2x2 : Square(Side => 2) := (Side => 2,
- Mat => ( (1, 2), (3, 4) ));
- Dbl_Mat_2x2 : Double_Square(Number => 2) := (2, Mat_2x2, Mat_2x2);
-
-
- Zero_2x2 : constant Square(2) := (2, Mat => ( (0, 0), (0, 0) ));
- Expected_2x2 : constant Double_Square(2) := (Number => 2,
- others => Zero_2x2);
-
-
-
- Mat_3x3 : Square(Side => 3) := (Side => 3,
- Mat => (1 => (1, 4, 9),
- others => (1 => 5,
- others => 7)));
- Dbl_Mat_3x3 : Double_Square(3) := (Number => 3, others => Mat_3x3);
-
-
- Zero_3x3 : constant Square(3) := (3, Mat => (others => (0,0,0)));
- Expected_3x3 : constant Double_Square(Number => 3) :=
- (3, Zero_3x3, Zero_3x3);
-
-
- -- Derived type with new discriminant part (which constrains parent):
-
- type New_Dbl_Sq (Num : Natural) is new Double_Square(Num);
-
- New_Dbl_2x2 : New_Dbl_Sq (Num => 2) := (2, Mat_2x2, Mat_2x2);
- Expected_New_2x2 : constant New_Dbl_Sq := (Num => 2, others => Zero_2x2);
-
-
-
- -- Instantiations:
-
- procedure Clr_Dbl is new CC51003_1 (Double_Square);
- procedure Clr_New_Dbl is new CC51003_1 (New_Dbl_Sq);
-
-
-begin
- Report.Test ("CC51003", "Check that a formal derived record type " &
- "inherits components, including discriminants, " &
- "from its ancestor type");
-
- -- Simulate use of matrix manipulation operations.
-
- Clr_Dbl (Dbl_Mat_2x2);
-
- if (Dbl_Mat_2x2 /= Expected_2x2) then
- Report.Failed ("Wrong result for root type (2x2 matrix)");
- end if;
-
-
- Clr_Dbl (Dbl_Mat_3x3);
-
- if (Dbl_Mat_3x3 /= Expected_3x3) then
- Report.Failed ("Wrong result for root type (3x3 matrix)");
- end if;
-
-
- Clr_New_Dbl (New_Dbl_2x2);
-
- if (New_Dbl_2x2 /= Expected_New_2x2) then
- Report.Failed ("Wrong result for derived type (2x2 matrix)");
- end if;
-
-
- Report.Result;
-
-end CC51003;