-- C420001.A
|
-- C420001.A
|
--
|
--
|
-- Grant of Unlimited Rights
|
-- Grant of Unlimited Rights
|
--
|
--
|
-- Under contracts F33600-87-D-0337, F33600-84-D-0280, MDA903-79-C-0687 and
|
-- Under contracts F33600-87-D-0337, F33600-84-D-0280, MDA903-79-C-0687 and
|
-- F08630-91-C-0015, the U.S. Government obtained unlimited rights in the
|
-- F08630-91-C-0015, the U.S. Government obtained unlimited rights in the
|
-- software and documentation contained herein. Unlimited rights are
|
-- software and documentation contained herein. Unlimited rights are
|
-- defined in DFAR 252.227-7013(a)(19). By making this public release,
|
-- defined in DFAR 252.227-7013(a)(19). By making this public release,
|
-- the Government intends to confer upon all recipients unlimited rights
|
-- the Government intends to confer upon all recipients unlimited rights
|
-- equal to those held by the Government. These rights include rights to
|
-- equal to those held by the Government. These rights include rights to
|
-- use, duplicate, release or disclose the released technical data and
|
-- use, duplicate, release or disclose the released technical data and
|
-- computer software in whole or in part, in any manner and for any purpose
|
-- computer software in whole or in part, in any manner and for any purpose
|
-- whatsoever, and to have or permit others to do so.
|
-- whatsoever, and to have or permit others to do so.
|
--
|
--
|
-- DISCLAIMER
|
-- DISCLAIMER
|
--
|
--
|
-- ALL MATERIALS OR INFORMATION HEREIN RELEASED, MADE AVAILABLE OR
|
-- ALL MATERIALS OR INFORMATION HEREIN RELEASED, MADE AVAILABLE OR
|
-- DISCLOSED ARE AS IS. THE GOVERNMENT MAKES NO EXPRESS OR IMPLIED
|
-- DISCLOSED ARE AS IS. THE GOVERNMENT MAKES NO EXPRESS OR IMPLIED
|
-- WARRANTY AS TO ANY MATTER WHATSOVER, INCLUDING THE CONDITIONS OF THE
|
-- WARRANTY AS TO ANY MATTER WHATSOVER, INCLUDING THE CONDITIONS OF THE
|
-- SOFTWARE, DOCUMENTATION OR OTHER INFORMATION RELEASED, MADE AVAILABLE
|
-- SOFTWARE, DOCUMENTATION OR OTHER INFORMATION RELEASED, MADE AVAILABLE
|
-- OR DISCLOSED, OR THE OWNERSHIP, MERCHANTABILITY, OR FITNESS FOR A
|
-- OR DISCLOSED, OR THE OWNERSHIP, MERCHANTABILITY, OR FITNESS FOR A
|
-- PARTICULAR PURPOSE OF SAID MATERIAL.
|
-- PARTICULAR PURPOSE OF SAID MATERIAL.
|
--*
|
--*
|
--
|
--
|
-- OBJECTIVE
|
-- OBJECTIVE
|
-- Check that if the index subtype of a string type is a modular subtype
|
-- Check that if the index subtype of a string type is a modular subtype
|
-- whose lower bound is zero, then the evaluation of a null string_literal
|
-- whose lower bound is zero, then the evaluation of a null string_literal
|
-- raises Constraint_Error. This was confirmed by AI95-00138.
|
-- raises Constraint_Error. This was confirmed by AI95-00138.
|
--
|
--
|
-- TEST DESCRIPTION
|
-- TEST DESCRIPTION
|
-- In this test, we have a generic formal modular type, and we have
|
-- In this test, we have a generic formal modular type, and we have
|
-- several null string literals of that type. Because the type is
|
-- several null string literals of that type. Because the type is
|
-- generic formal, the string literals are not static, and therefore
|
-- generic formal, the string literals are not static, and therefore
|
-- the Constraint_Error should be detected at run time.
|
-- the Constraint_Error should be detected at run time.
|
--
|
--
|
-- CHANGE HISTORY:
|
-- CHANGE HISTORY:
|
-- 29 JUN 1999 RAD Initial Version
|
-- 29 JUN 1999 RAD Initial Version
|
-- 23 SEP 1999 RLB Improved comments and messages, renamed, issued.
|
-- 23 SEP 1999 RLB Improved comments and messages, renamed, issued.
|
--
|
--
|
--!
|
--!
|
with Report; use Report; pragma Elaborate_All(Report);
|
with Report; use Report; pragma Elaborate_All(Report);
|
with System;
|
with System;
|
procedure C420001 is
|
procedure C420001 is
|
generic
|
generic
|
type Modular is mod <>;
|
type Modular is mod <>;
|
package Mod_Test is
|
package Mod_Test is
|
type Str is array(Modular range <>) of Character;
|
type Str is array(Modular range <>) of Character;
|
procedure Test_String_Literal;
|
procedure Test_String_Literal;
|
end Mod_Test;
|
end Mod_Test;
|
|
|
package body Mod_Test is
|
package body Mod_Test is
|
procedure Test_String_Literal is
|
procedure Test_String_Literal is
|
begin
|
begin
|
begin
|
begin
|
declare
|
declare
|
Null_String: Str := ""; -- Should raise C_E.
|
Null_String: Str := ""; -- Should raise C_E.
|
begin
|
begin
|
Comment(String(Null_String)); -- Avoid 11.6 issues.
|
Comment(String(Null_String)); -- Avoid 11.6 issues.
|
end;
|
end;
|
Failed("Null string didn't raise Constraint_Error");
|
Failed("Null string didn't raise Constraint_Error");
|
exception
|
exception
|
when Exc: Constraint_Error =>
|
when Exc: Constraint_Error =>
|
null; -- Comment("Constraint_Error -- OK");
|
null; -- Comment("Constraint_Error -- OK");
|
when Exc2: others =>
|
when Exc2: others =>
|
Failed("Null string raised wrong exception");
|
Failed("Null string raised wrong exception");
|
end;
|
end;
|
begin
|
begin
|
Failed(String(Str'(""))); -- Should raise C_E, not do Failed.
|
Failed(String(Str'(""))); -- Should raise C_E, not do Failed.
|
Failed("Null string didn't raise Constraint_Error");
|
Failed("Null string didn't raise Constraint_Error");
|
exception
|
exception
|
when Exc: Constraint_Error =>
|
when Exc: Constraint_Error =>
|
null; -- Comment("Constraint_Error -- OK");
|
null; -- Comment("Constraint_Error -- OK");
|
when Exc2: others =>
|
when Exc2: others =>
|
Failed("Null string raised wrong exception");
|
Failed("Null string raised wrong exception");
|
end;
|
end;
|
end Test_String_Literal;
|
end Test_String_Literal;
|
begin
|
begin
|
Test_String_Literal;
|
Test_String_Literal;
|
end Mod_Test;
|
end Mod_Test;
|
begin
|
begin
|
Test("C420001", "Check that if the index subtype of a string type is a " &
|
Test("C420001", "Check that if the index subtype of a string type is a " &
|
"modular subtype whose lower bound is zero, then the " &
|
"modular subtype whose lower bound is zero, then the " &
|
"evaluation of a null string_literal raises " &
|
"evaluation of a null string_literal raises " &
|
"Constraint_Error. ");
|
"Constraint_Error. ");
|
declare
|
declare
|
type M1 is mod 1;
|
type M1 is mod 1;
|
package Test_M1 is new Mod_Test(M1);
|
package Test_M1 is new Mod_Test(M1);
|
type M2 is mod 2;
|
type M2 is mod 2;
|
package Test_M2 is new Mod_Test(M2);
|
package Test_M2 is new Mod_Test(M2);
|
type M3 is mod 3;
|
type M3 is mod 3;
|
package Test_M3 is new Mod_Test(M3);
|
package Test_M3 is new Mod_Test(M3);
|
type M4 is mod 4;
|
type M4 is mod 4;
|
package Test_M4 is new Mod_Test(M4);
|
package Test_M4 is new Mod_Test(M4);
|
type M5 is mod 5;
|
type M5 is mod 5;
|
package Test_M5 is new Mod_Test(M5);
|
package Test_M5 is new Mod_Test(M5);
|
type M6 is mod 6;
|
type M6 is mod 6;
|
package Test_M6 is new Mod_Test(M6);
|
package Test_M6 is new Mod_Test(M6);
|
type M7 is mod 7;
|
type M7 is mod 7;
|
package Test_M7 is new Mod_Test(M7);
|
package Test_M7 is new Mod_Test(M7);
|
type M8 is mod 8;
|
type M8 is mod 8;
|
package Test_M8 is new Mod_Test(M8);
|
package Test_M8 is new Mod_Test(M8);
|
type M_Max_Binary_Modulus is mod System.Max_Binary_Modulus;
|
type M_Max_Binary_Modulus is mod System.Max_Binary_Modulus;
|
package Test_M_Max_Binary_Modulus is new Mod_Test(M_Max_Binary_Modulus);
|
package Test_M_Max_Binary_Modulus is new Mod_Test(M_Max_Binary_Modulus);
|
type M_Max_Nonbinary_Modulus is mod System.Max_Nonbinary_Modulus;
|
type M_Max_Nonbinary_Modulus is mod System.Max_Nonbinary_Modulus;
|
package Test_M_Max_Nonbinary_Modulus is new Mod_Test(M_Max_Nonbinary_Modulus);
|
package Test_M_Max_Nonbinary_Modulus is new Mod_Test(M_Max_Nonbinary_Modulus);
|
begin
|
begin
|
null;
|
null;
|
end;
|
end;
|
Result;
|
Result;
|
end C420001;
|
end C420001;
|
|
|