CVS difference for acats/cxa/cxa5012.a
--- acats/cxa/cxa5012.a 1998/09/29 01:41:54 1.2
+++ acats/cxa/cxa5012.a 1999/09/16 20:37:56 1.3
@@ -3,22 +3,22 @@
-- Grant of Unlimited Rights
--
-- Under contracts F33600-87-D-0337, F33600-84-D-0280, MDA903-79-C-0687,
--- d DCA100-97-D-0025, the U.S. Government obtained
+-- F08630-91-C-0015, and DCA100-97-D-0025, the U.S. Government obtained
-- unlimited rights in the software and documentation contained herein.
--- defined in DFAR 252.227-7013(a)(19). By making
--- the Government intends to confer upon all
--- rights equal to those held by the Government.
--- rights to use, duplicate, release or disclose the
--- ata and computer software in whole or in part, in
--- ny purpose whatsoever, and to have or permit others
+-- 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
--- THE GOVERNMENT MAKES NO EXPRESS OR IMPLIED
+-- DISCLOSED ARE AS IS. THE GOVERNMENT MAKES NO EXPRESS OR IMPLIED
-- WARRANTY AS TO ANY MATTER WHATSOEVER, INCLUDING THE CONDITIONS OF THE
--- ION OR OTHER INFORMATION RELEASED, MADE AVAILABLE
+-- SOFTWARE, DOCUMENTATION OR OTHER INFORMATION RELEASED, MADE AVAILABLE
-- OR DISCLOSED, OR THE OWNERSHIP, MERCHANTABILITY, OR FITNESS FOR A
-- PARTICULAR PURPOSE OF SAID MATERIAL.
--*
@@ -31,21 +31,23 @@
-- the specific state to the generator following some intermediate
-- generator activity.
-- 2) the Function Image can be used to obtain a string
--- f the state of a generator; and that the
+-- representation of the state of a generator; and that the
-- Function Value will transform a string representation of the
-- state of a random number generator into the actual state object.
--- on Value, with a string value that is
--- any generator state, will raise Constraint_Error.
---
+-- 3) a call to Function Value, with a string value that is
+-- not the image of any generator state, is a bounded error. This
+-- error either raises Constraint_Error or Program_Error, or is
+-- accepted. (See Technical Corrigendum 1).
+--
-- TEST DESCRIPTION:
-- This test evaluates components of the Ada.Numerics.Float_Random and
--- te_Random packages.
--- block of this test uses Procedure Save to
+-- Ada.Numerics.Discrete_Random packages.
+-- The first objective block of this test uses Procedure Save to
-- save the particular state of a random number generator. The random
-- number generator then generates a series of random numbers. The
-- saved state variable is then used to reset (using Procedure Reset)
--- to the state it was in at the point of the call
--- lues are then generated from this restored
+-- the generator back to the state it was in at the point of the call
+-- to Save. Random values are then generated from this restored
-- generator, and compared with expected values.
-- The second objective block of this test uses Function Image to
-- provide a string representation of a state code. This string is
@@ -53,12 +55,15 @@
-- random number generator to the saved state. Random values are
-- likewise generated from this restored generator, and compared with
-- expected values.
---
---
+--
+--
-- CHANGE HISTORY:
-- 25 Apr 95 SAIC Initial prerelease version.
-- 17 Jul 95 SAIC Incorporated reviewer comments.
--- Change subtype upper limit from 100_000 to 10_000.
+-- 17 Dec 97 EDS Change subtype upper limit from 100_000 to 10_000.
+-- 16 Sep 99 RLB Updated objective 3 for Technical Corrigendum 1
+-- changes.
+
--!
with Ada.Numerics.Float_Random;
@@ -96,7 +101,7 @@
EGen_1, EGen_2 : Card_Pack.Generator;
FGen_1, FGen_2 : Float_Random.Generator;
- -- Variables declared to hold random numbers over the inclusive range
+ -- Variables declared to hold random numbers over the inclusive range
-- of their corresponding type.
DVal_1, DVal_2 : Discrete_Range;
@@ -111,7 +116,7 @@
FState_1, FState_2 : Float_Random.State;
-- Declaration of bounded string packages instantiated with the
- -- value of Max_Image_Width constant, and bounded string variables
+ -- value of Max_Image_Width constant, and bounded string variables
-- used to hold the image of random number generator states.
package DString_Pack is
@@ -123,17 +128,17 @@
use DString_Pack, EString_Pack, FString_Pack;
- DString_1, DString_2 : DString_Pack.Bounded_String :=
+ DString_1, DString_2 : DString_Pack.Bounded_String :=
DString_Pack.Null_Bounded_String;
- EString_1, EString_2 : EString_Pack.Bounded_String :=
+ EString_1, EString_2 : EString_Pack.Bounded_String :=
EString_Pack.Null_Bounded_String;
- FString_1, FString_2 : FString_Pack.Bounded_String :=
+ FString_1, FString_2 : FString_Pack.Bounded_String :=
FString_Pack.Null_Bounded_String;
-- Test variables.
TC_Count : Natural;
- TC_Discrete_Check_Failed,
+ TC_Discrete_Check_Failed,
TC_Enum_Check_Failed,
TC_Float_Check_Failed : Boolean := False;
TC_Seed : Integer;
@@ -155,7 +160,7 @@
of Discrete_Range;
TC_Enum_Array : array (First_Row..Second_Row, 1..TC_Max_Values)
of Suit_Of_Cards;
- TC_Float_Array : array (First_Row..Second_Row, 1..TC_Max_Values)
+ TC_Float_Array : array (First_Row..Second_Row, 1..TC_Max_Values)
of Float_Random.Uniformly_Distributed;
begin
@@ -182,7 +187,7 @@
Card_Pack.Reset (Gen => EGen_1, From_State => EState_1);
Float_Random.Reset (Gen => FGen_1, From_State => FState_1);
- -- The same random number generators are used to fill the first half
+ -- The same random number generators are used to fill the first half
-- of the second row of the arrays with randomly generated values.
for i in 1..TC_Max_Values/2 loop
@@ -206,7 +211,7 @@
Card_Pack.Save(Gen => EGen_1, To_State => EState_1);
Float_Random.Save (Gen => FGen_1, To_State => FState_1);
- -- The last half of the first row of the arrays are filled with
+ -- The last half of the first row of the arrays are filled with
-- values generated from the same random number generators.
for i in (TC_Max_Values/2 + 1)..TC_Max_Values loop
@@ -222,7 +227,7 @@
Card_Pack.Reset(Gen => EGen_1, From_State => EState_1);
Float_Random.Reset (Gen => FGen_1, From_State => FState_1);
- -- The last half of the second row of the arrays are filled with
+ -- The last half of the second row of the arrays are filled with
-- values generated from the same random number generator.
-- These values should exactly mirror the values in the last half
-- of the first row of the arrays that had been previously generated.
@@ -236,8 +241,8 @@
-- Check that the values in the two rows of the arrays are identical.
for i in 1..TC_Max_Values loop
- if TC_Discrete_Array(First_Row,i) /=
- TC_Discrete_Array(Second_Row,i)
+ if TC_Discrete_Array(First_Row,i) /=
+ TC_Discrete_Array(Second_Row,i)
then
TC_Discrete_Check_Failed := True;
exit;
@@ -252,7 +257,7 @@
end loop;
for i in 1..TC_Max_Values loop
- if TC_Float_Array(First_Row,i) /= TC_Float_Array(Second_Row,i)
+ if TC_Float_Array(First_Row,i) /= TC_Float_Array(Second_Row,i)
then
TC_Float_Check_Failed := True;
exit;
@@ -286,11 +291,11 @@
-- Check that the Function Image can be used to obtain a string
-- representation of the state of a generator.
-- Check that the Function Value will transform a string
- -- representation of the state of a random number generator
+ -- representation of the state of a random number generator
-- into the actual state object.
begin
- -- Use two discrete and float random number generators to generate
+ -- Use two discrete and float random number generators to generate
-- a series of values (so that the generators are no longer in their
-- initial states, and they have generated the same number of
-- random values).
@@ -357,7 +362,7 @@
-- The string representation of a state code is transformed back
-- to a state code variable using the Function Value.
- DState_1 := Discrete_Pack.Value(Coded_State =>
+ DState_1 := Discrete_Pack.Value(Coded_State =>
DString_Pack.To_String(DString_1));
EState_1 := Card_Pack.Value(EString_Pack.To_String(EString_1));
FState_1 := Float_Random.Value(FString_Pack.To_String(FString_1));
@@ -380,11 +385,11 @@
Card_Pack.Reset (Gen => EGen_1, From_State => EState_1);
Float_Random.Reset (Gen => FGen_1, From_State => FState_1);
- -- All generators should now be in the same state, so the
+ -- All generators should now be in the same state, so the
-- random values they produce should be the same.
for i in 1..1000 loop
- if Discrete_Pack.Random(DGen_1) /= Discrete_Pack.Random(DGen_2)
+ if Discrete_Pack.Random(DGen_1) /= Discrete_Pack.Random(DGen_2)
then
TC_Discrete_Check_Failed := True;
exit;
@@ -399,7 +404,7 @@
end loop;
for i in 1..1000 loop
- if Float_Random.Random(FGen_1) /= Float_Random.Random(FGen_2)
+ if Float_Random.Random(FGen_1) /= Float_Random.Random(FGen_2)
then
TC_Float_Check_Failed := True;
exit;
@@ -427,22 +432,40 @@
Objective_3:
- -- Check that a call to Function Value, with a string value that is
- -- not the image of any generator state, will raise Constraint_Error.
+ -- Check that a call to Function Value, with a string value that is
+ -- not the image of any generator state, is a bounded error. This
+ -- error either raises Constraint_Error or Program_Error, or is
+ -- accepted. (See Technical Corrigendum 1).
declare
Not_A_State : constant String := ImpDef.Non_State_String;
begin
-
+
begin
DState_1 := Discrete_Pack.Value(Not_A_State);
- Report.Failed("Constraint_Error not raised by Function " &
- "Ada.Numerics.Discrete_Random.Value when " &
- "provided a string input that does not " &
- "represent the state of a random number " &
- "generator");
+ if Not_A_State /= "**NONE**" then
+ Report.Failed("Exception not raised by Function " &
+ "Ada.Numerics.Discrete_Random.Value when " &
+ "provided a string input that does not " &
+ "represent the state of a random number " &
+ "generator");
+ else
+ Report.Comment("All strings represent states for Function " &
+ "Ada.Numerics.Discrete_Random.Value");
+ end if;
Discrete_Pack.Reset(DGen_1, DState_1);
exception
when Constraint_Error => null; -- OK, expected exception.
+ Report.Comment("Constraint_Error raised by Function " &
+ "Ada.Numerics.Discrete_Random.Value when " &
+ "provided a string input that does not " &
+ "represent the state of a random number " &
+ "generator");
+ when Program_Error => -- OK, expected exception.
+ Report.Comment("Program_Error raised by Function " &
+ "Ada.Numerics.Discrete_Random.Value when " &
+ "provided a string input that does not " &
+ "represent the state of a random number " &
+ "generator");
when others =>
Report.Failed("Unexpected exception raised by Function " &
"Ada.Numerics.Discrete_Random.Value when " &
@@ -453,14 +476,20 @@
begin
EState_1 := Card_Pack.Value(Not_A_State);
- Report.Failed("Constraint_Error not raised by Function " &
- "Ada.Numerics.Discrete_Random.Value when " &
- "provided a string input that does not " &
- "represent the state of an enumeration " &
- "random number generator");
+ if Not_A_State /= "**NONE**" then
+ Report.Failed("Exception not raised by Function " &
+ "Ada.Numerics.Discrete_Random.Value when " &
+ "provided a string input that does not " &
+ "represent the state of an enumeration " &
+ "random number generator");
+ else
+ Report.Comment("All strings represent states for Function " &
+ "Ada.Numerics.Discrete_Random.Value");
+ end if;
Card_Pack.Reset(EGen_1, EState_1);
exception
when Constraint_Error => null; -- OK, expected exception.
+ when Program_Error => null; -- OK, expected exception.
when others =>
Report.Failed("Unexpected exception raised by Function " &
"Ada.Numerics.Discrete_Random.Value when " &
@@ -471,15 +500,21 @@
begin
FState_1 := Float_Random.Value(Not_A_State);
- Report.Failed("Constraint_Error not raised by an " &
- "instantiated version of " &
- "Ada.Numerics.Float_Random.Value when " &
- "provided a string input that does not " &
- "represent the state of a random number " &
- "generator");
+ if Not_A_State /= "**NONE**" then
+ Report.Failed("Exception not raised by an " &
+ "instantiated version of " &
+ "Ada.Numerics.Float_Random.Value when " &
+ "provided a string input that does not " &
+ "represent the state of a random number " &
+ "generator");
+ else
+ Report.Comment("All strings represent states for Function " &
+ "Ada.Numerics.Float_Random.Value");
+ end if;
Float_Random.Reset(FGen_1, FState_1);
exception
when Constraint_Error => null; -- OK, expected exception.
+ when Program_Error => null; -- OK, expected exception.
when others =>
Report.Failed("Unexpected exception raised by an " &
"instantiated version of " &
Questions? Ask the ACAA Technical Agent