-- CXAA017.A
|
-- CXAA017.A
|
--
|
--
|
-- Grant of Unlimited Rights
|
-- Grant of Unlimited Rights
|
--
|
--
|
-- Under contracts F33600-87-D-0337, F33600-84-D-0280, MDA903-79-C-0687,
|
-- 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
|
-- 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 in the software and documentation contained herein.
|
-- Unlimited rights are defined in DFAR 252.227-7013(a)(19). By making
|
-- Unlimited rights are defined in DFAR 252.227-7013(a)(19). By making
|
-- this public release, the Government intends to confer upon all
|
-- this public release, the Government intends to confer upon all
|
-- recipients unlimited rights equal to those held by the Government.
|
-- recipients unlimited rights equal to those held by the Government.
|
-- These rights include rights to use, duplicate, release or disclose the
|
-- These rights include rights to use, duplicate, release or disclose the
|
-- released technical data and computer software in whole or in part, in
|
-- 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
|
-- any manner and for any purpose whatsoever, and to have or permit others
|
-- to do so.
|
-- 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 WHATSOEVER, INCLUDING THE CONDITIONS OF THE
|
-- WARRANTY AS TO ANY MATTER WHATSOEVER, 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 Ada.Text_IO function Look_Ahead sets parameter End_Of_Line
|
-- Check that Ada.Text_IO function Look_Ahead sets parameter End_Of_Line
|
-- to True if at the end of a line; otherwise check that it returns the
|
-- to True if at the end of a line; otherwise check that it returns the
|
-- next character from a file (without consuming it), while setting
|
-- next character from a file (without consuming it), while setting
|
-- End_Of_Line to False.
|
-- End_Of_Line to False.
|
--
|
--
|
-- Check that Ada.Text_IO function Get_Immediate will return the next
|
-- Check that Ada.Text_IO function Get_Immediate will return the next
|
-- control or graphic character in parameter Item from the specified
|
-- control or graphic character in parameter Item from the specified
|
-- file. Check that the version of Ada.Text_IO function Get_Immediate
|
-- file. Check that the version of Ada.Text_IO function Get_Immediate
|
-- with the Available parameter will, if a character is available in the
|
-- with the Available parameter will, if a character is available in the
|
-- specified file, return the character in parameter Item, and set
|
-- specified file, return the character in parameter Item, and set
|
-- parameter Available to True.
|
-- parameter Available to True.
|
--
|
--
|
-- TEST DESCRIPTION:
|
-- TEST DESCRIPTION:
|
-- This test exercises specific capabilities of two Text_IO subprograms,
|
-- This test exercises specific capabilities of two Text_IO subprograms,
|
-- Look_Ahead and Get_Immediate. A file is prepared that contains a
|
-- Look_Ahead and Get_Immediate. A file is prepared that contains a
|
-- variety of graphic and control characters on several lines.
|
-- variety of graphic and control characters on several lines.
|
-- In processing this file, a call to Look_Ahead is performed to ensure
|
-- In processing this file, a call to Look_Ahead is performed to ensure
|
-- that characters are available, then individual characters are
|
-- that characters are available, then individual characters are
|
-- extracted from the current line using Get_Immediate. The characters
|
-- extracted from the current line using Get_Immediate. The characters
|
-- returned from both subprogram calls are compared with the expected
|
-- returned from both subprogram calls are compared with the expected
|
-- character result. Processing on each file line continues until
|
-- character result. Processing on each file line continues until
|
-- Look_Ahead indicates that the end of the line is next. Separate
|
-- Look_Ahead indicates that the end of the line is next. Separate
|
-- verification is performed to ensure that all characters of each line
|
-- verification is performed to ensure that all characters of each line
|
-- are processed, and that the Available and End_Of_Line parameters
|
-- are processed, and that the Available and End_Of_Line parameters
|
-- of the subprograms are properly set in the appropriate instances.
|
-- of the subprograms are properly set in the appropriate instances.
|
--
|
--
|
-- APPLICABILITY CRITERIA:
|
-- APPLICABILITY CRITERIA:
|
-- This test is applicable to implementations capable of supporting
|
-- This test is applicable to implementations capable of supporting
|
-- external Text_IO files.
|
-- external Text_IO files.
|
--
|
--
|
--
|
--
|
-- CHANGE HISTORY:
|
-- CHANGE HISTORY:
|
-- 30 May 95 SAIC Initial prerelease version.
|
-- 30 May 95 SAIC Initial prerelease version.
|
-- 01 May 96 SAIC Incorporated reviewer comments for ACVC 2.1.
|
-- 01 May 96 SAIC Incorporated reviewer comments for ACVC 2.1.
|
-- 26 Feb 97 PWB.CTA Allowed for non-support of some IO operations.
|
-- 26 Feb 97 PWB.CTA Allowed for non-support of some IO operations.
|
--!
|
--!
|
|
|
with Ada.Text_IO;
|
with Ada.Text_IO;
|
package CXAA017_0 is
|
package CXAA017_0 is
|
|
|
User_Defined_Input_File : aliased Ada.Text_IO.File_Type;
|
User_Defined_Input_File : aliased Ada.Text_IO.File_Type;
|
|
|
end CXAA017_0;
|
end CXAA017_0;
|
|
|
|
|
with CXAA017_0; use CXAA017_0;
|
with CXAA017_0; use CXAA017_0;
|
with Ada.Characters.Latin_1;
|
with Ada.Characters.Latin_1;
|
with Ada.Exceptions;
|
with Ada.Exceptions;
|
with Ada.Text_IO;
|
with Ada.Text_IO;
|
with Report;
|
with Report;
|
|
|
procedure CXAA017 is
|
procedure CXAA017 is
|
|
|
use Ada.Characters.Latin_1;
|
use Ada.Characters.Latin_1;
|
use Ada.Exceptions;
|
use Ada.Exceptions;
|
use Ada.Text_IO;
|
use Ada.Text_IO;
|
|
|
Non_Applicable_System : exception;
|
Non_Applicable_System : exception;
|
No_Reset : exception;
|
No_Reset : exception;
|
|
|
begin
|
begin
|
|
|
Report.Test ("CXAA017", "Check that Ada.Text_IO subprograms " &
|
Report.Test ("CXAA017", "Check that Ada.Text_IO subprograms " &
|
"Look_Ahead and Get_Immediate are available " &
|
"Look_Ahead and Get_Immediate are available " &
|
"and produce correct results");
|
"and produce correct results");
|
|
|
Test_Block:
|
Test_Block:
|
declare
|
declare
|
|
|
User_Input_Ptr : File_Access := User_Defined_Input_File'Access;
|
User_Input_Ptr : File_Access := User_Defined_Input_File'Access;
|
|
|
UDLA_Char, -- Acronym UDLA => "User Defined Look Ahead"
|
UDLA_Char, -- Acronym UDLA => "User Defined Look Ahead"
|
UDGI_Char, -- Acronym UDGI => "User Defined Get Immediate"
|
UDGI_Char, -- Acronym UDGI => "User Defined Get Immediate"
|
TC_Char : Character := Ada.Characters.Latin_1.NUL;
|
TC_Char : Character := Ada.Characters.Latin_1.NUL;
|
|
|
UDLA_End_Of_Line,
|
UDLA_End_Of_Line,
|
UDGI_Available : Boolean := False;
|
UDGI_Available : Boolean := False;
|
|
|
Char_Pos : Natural;
|
Char_Pos : Natural;
|
|
|
-- This string contains five ISO 646 Control characters and six ISO 646
|
-- This string contains five ISO 646 Control characters and six ISO 646
|
-- Graphic characters:
|
-- Graphic characters:
|
TC_String_1 : constant String := STX &
|
TC_String_1 : constant String := STX &
|
SI &
|
SI &
|
DC2 &
|
DC2 &
|
CAN &
|
CAN &
|
US &
|
US &
|
Space &
|
Space &
|
Ampersand &
|
Ampersand &
|
Solidus &
|
Solidus &
|
'A' &
|
'A' &
|
LC_X &
|
LC_X &
|
DEL;
|
DEL;
|
|
|
-- This string contains two ISO 6429 Control and six ISO 6429 Graphic
|
-- This string contains two ISO 6429 Control and six ISO 6429 Graphic
|
-- characters:
|
-- characters:
|
TC_String_2 : constant String := IS4 &
|
TC_String_2 : constant String := IS4 &
|
SCI &
|
SCI &
|
Yen_Sign &
|
Yen_Sign &
|
Masculine_Ordinal_Indicator &
|
Masculine_Ordinal_Indicator &
|
UC_I_Grave &
|
UC_I_Grave &
|
Multiplication_Sign &
|
Multiplication_Sign &
|
LC_C_Cedilla &
|
LC_C_Cedilla &
|
LC_Icelandic_Thorn;
|
LC_Icelandic_Thorn;
|
|
|
TC_Number_Of_Strings : constant := 2;
|
TC_Number_Of_Strings : constant := 2;
|
|
|
type String_Access_Type is access constant String;
|
type String_Access_Type is access constant String;
|
type String_Ptr_Array_Type is
|
type String_Ptr_Array_Type is
|
array (1..TC_Number_Of_Strings) of String_Access_Type;
|
array (1..TC_Number_Of_Strings) of String_Access_Type;
|
|
|
TC_String_Ptr_Array : String_Ptr_Array_Type :=
|
TC_String_Ptr_Array : String_Ptr_Array_Type :=
|
(new String'(TC_String_1),
|
(new String'(TC_String_1),
|
new String'(TC_String_2));
|
new String'(TC_String_2));
|
|
|
|
|
|
|
procedure Create_New_File (The_File : in out File_Type;
|
procedure Create_New_File (The_File : in out File_Type;
|
Mode : in File_Mode;
|
Mode : in File_Mode;
|
Next : in Integer) is
|
Next : in Integer) is
|
begin
|
begin
|
Create (The_File, Mode, Report.Legal_File_Name(Next));
|
Create (The_File, Mode, Report.Legal_File_Name(Next));
|
exception
|
exception
|
-- The following two exceptions can be raised if a system is not
|
-- The following two exceptions can be raised if a system is not
|
-- capable of supporting external Text_IO files. The handler will
|
-- capable of supporting external Text_IO files. The handler will
|
-- raise a user-defined exception which will result in a
|
-- raise a user-defined exception which will result in a
|
-- Not_Applicable result for the test.
|
-- Not_Applicable result for the test.
|
when Use_Error | Name_Error => raise Non_Applicable_System;
|
when Use_Error | Name_Error => raise Non_Applicable_System;
|
end Create_New_File;
|
end Create_New_File;
|
|
|
|
|
|
|
procedure Load_File (The_File : in out File_Type) is
|
procedure Load_File (The_File : in out File_Type) is
|
-- This procedure will load several strings into the file denoted
|
-- This procedure will load several strings into the file denoted
|
-- by the input parameter. A call to New_Line will add line/page
|
-- by the input parameter. A call to New_Line will add line/page
|
-- termination characters, which will be available for processing
|
-- termination characters, which will be available for processing
|
-- along with the text in the file.
|
-- along with the text in the file.
|
begin
|
begin
|
Put_Line (The_File, TC_String_Ptr_Array(1).all);
|
Put_Line (The_File, TC_String_Ptr_Array(1).all);
|
New_Line (The_File, Spacing => 1);
|
New_Line (The_File, Spacing => 1);
|
Put_Line (The_File, TC_String_Ptr_Array(2).all);
|
Put_Line (The_File, TC_String_Ptr_Array(2).all);
|
end Load_File;
|
end Load_File;
|
|
|
|
|
begin
|
begin
|
|
|
-- Create user-defined text file that will serve as the appropriate
|
-- Create user-defined text file that will serve as the appropriate
|
-- sources of input to the procedures under test.
|
-- sources of input to the procedures under test.
|
|
|
Create_New_File (User_Defined_Input_File, Out_File, 1);
|
Create_New_File (User_Defined_Input_File, Out_File, 1);
|
|
|
-- Enter several lines of text into the new input file.
|
-- Enter several lines of text into the new input file.
|
-- The characters that make up these text strings will be processed
|
-- The characters that make up these text strings will be processed
|
-- using the procedures being exercised in this test.
|
-- using the procedures being exercised in this test.
|
|
|
Load_File (User_Defined_Input_File);
|
Load_File (User_Defined_Input_File);
|
|
|
-- Check that Mode_Error is raised by Look_Ahead and Get_Immedidate
|
-- Check that Mode_Error is raised by Look_Ahead and Get_Immedidate
|
-- if the mode of the file object is not In_File.
|
-- if the mode of the file object is not In_File.
|
-- Currently, the file mode is Out_File.
|
-- Currently, the file mode is Out_File.
|
|
|
begin
|
begin
|
Look_Ahead(User_Defined_Input_File, UDLA_Char, UDLA_End_Of_Line);
|
Look_Ahead(User_Defined_Input_File, UDLA_Char, UDLA_End_Of_Line);
|
Report.Failed("Mode_Error not raised by Look_Ahead");
|
Report.Failed("Mode_Error not raised by Look_Ahead");
|
Report.Comment("This char should never be printed: " & UDLA_Char);
|
Report.Comment("This char should never be printed: " & UDLA_Char);
|
exception
|
exception
|
when Mode_Error => null; -- OK, expected exception.
|
when Mode_Error => null; -- OK, expected exception.
|
when The_Error : others =>
|
when The_Error : others =>
|
Report.Failed ("The following exception was raised during the " &
|
Report.Failed ("The following exception was raised during the " &
|
"check that Look_Ahead raised Mode_Error when " &
|
"check that Look_Ahead raised Mode_Error when " &
|
"provided a file object that is not in In_File " &
|
"provided a file object that is not in In_File " &
|
"mode: " & Exception_Name(The_Error));
|
"mode: " & Exception_Name(The_Error));
|
end;
|
end;
|
|
|
begin
|
begin
|
Get_Immediate(User_Defined_Input_File, UDGI_Char);
|
Get_Immediate(User_Defined_Input_File, UDGI_Char);
|
Report.Failed("Mode_Error not raised by Get_Immediate");
|
Report.Failed("Mode_Error not raised by Get_Immediate");
|
Report.Comment("This char should never be printed: " & UDGI_Char);
|
Report.Comment("This char should never be printed: " & UDGI_Char);
|
exception
|
exception
|
when Mode_Error => null; -- OK, expected exception.
|
when Mode_Error => null; -- OK, expected exception.
|
when The_Error : others =>
|
when The_Error : others =>
|
Report.Failed ("The following exception was raised during the " &
|
Report.Failed ("The following exception was raised during the " &
|
"check that Get_Immediate raised Mode_Error " &
|
"check that Get_Immediate raised Mode_Error " &
|
"when provided a file object that is not in " &
|
"when provided a file object that is not in " &
|
"In_File mode: " & Exception_Name(The_Error));
|
"In_File mode: " & Exception_Name(The_Error));
|
end;
|
end;
|
|
|
|
|
-- The file will then be reset to In_File mode to properly function as
|
-- The file will then be reset to In_File mode to properly function as
|
-- a source of input.
|
-- a source of input.
|
|
|
Reset1:
|
Reset1:
|
begin
|
begin
|
Reset (User_Defined_Input_File, In_File);
|
Reset (User_Defined_Input_File, In_File);
|
exception
|
exception
|
when Ada.Text_IO.Use_Error =>
|
when Ada.Text_IO.Use_Error =>
|
Report.Not_Applicable
|
Report.Not_Applicable
|
( "Reset to In_File not supported for Text_IO" );
|
( "Reset to In_File not supported for Text_IO" );
|
raise No_Reset;
|
raise No_Reset;
|
end Reset1;
|
end Reset1;
|
|
|
-- Process the input file, exercising various Text_IO
|
-- Process the input file, exercising various Text_IO
|
-- functionality, and validating the results at each step.
|
-- functionality, and validating the results at each step.
|
-- Note: The designated File_Access object is used in processing
|
-- Note: The designated File_Access object is used in processing
|
-- the New_Default_Input_File in the second loop below.
|
-- the New_Default_Input_File in the second loop below.
|
|
|
-- Process characters in first line of text of each file.
|
-- Process characters in first line of text of each file.
|
|
|
Char_Pos := 1;
|
Char_Pos := 1;
|
|
|
-- Check that the first line is not blank.
|
-- Check that the first line is not blank.
|
|
|
Look_Ahead(User_Defined_Input_File, UDLA_Char, UDLA_End_Of_Line);
|
Look_Ahead(User_Defined_Input_File, UDLA_Char, UDLA_End_Of_Line);
|
|
|
while not UDLA_End_Of_Line loop
|
while not UDLA_End_Of_Line loop
|
|
|
-- Use the Get_Immediate procedure on the file to get the next
|
-- Use the Get_Immediate procedure on the file to get the next
|
-- available character on the current line.
|
-- available character on the current line.
|
|
|
Get_Immediate(User_Defined_Input_File, UDGI_Char);
|
Get_Immediate(User_Defined_Input_File, UDGI_Char);
|
|
|
-- Check that the characters returned by both procedures are the
|
-- Check that the characters returned by both procedures are the
|
-- same, and that they match the expected character from the file.
|
-- same, and that they match the expected character from the file.
|
|
|
if UDLA_Char /= TC_String_Ptr_Array(1).all(Char_Pos) or
|
if UDLA_Char /= TC_String_Ptr_Array(1).all(Char_Pos) or
|
UDGI_Char /= TC_String_Ptr_Array(1).all(Char_Pos)
|
UDGI_Char /= TC_String_Ptr_Array(1).all(Char_Pos)
|
then
|
then
|
Report.Failed("Incorrect retrieval of character " &
|
Report.Failed("Incorrect retrieval of character " &
|
Integer'Image(Char_Pos) & " of first string");
|
Integer'Image(Char_Pos) & " of first string");
|
end if;
|
end if;
|
|
|
-- Increment the character position counter.
|
-- Increment the character position counter.
|
Char_Pos := Char_Pos + 1;
|
Char_Pos := Char_Pos + 1;
|
|
|
-- Check the next character on the line. If at the end of line,
|
-- Check the next character on the line. If at the end of line,
|
-- the processing flow will exit the While loop.
|
-- the processing flow will exit the While loop.
|
|
|
Look_Ahead(User_Defined_Input_File, UDLA_Char, UDLA_End_Of_Line);
|
Look_Ahead(User_Defined_Input_File, UDLA_Char, UDLA_End_Of_Line);
|
|
|
end loop;
|
end loop;
|
|
|
-- Check to ensure that the "end of line" results returned from the
|
-- Check to ensure that the "end of line" results returned from the
|
-- Look_Ahead procedure (used to exit the above While loop) corresponds
|
-- Look_Ahead procedure (used to exit the above While loop) corresponds
|
-- with the result of Function End_Of_Line.
|
-- with the result of Function End_Of_Line.
|
|
|
if not End_Of_Line(User_Defined_Input_File)
|
if not End_Of_Line(User_Defined_Input_File)
|
then
|
then
|
Report.Failed("Result of procedure Look_Ahead that indicated " &
|
Report.Failed("Result of procedure Look_Ahead that indicated " &
|
"being at the end of the line does not correspond " &
|
"being at the end of the line does not correspond " &
|
"with the result of function End_Of_Line");
|
"with the result of function End_Of_Line");
|
end if;
|
end if;
|
|
|
-- Check that all characters in the string were processed.
|
-- Check that all characters in the string were processed.
|
|
|
if Char_Pos-1 /= TC_String_1'Length then
|
if Char_Pos-1 /= TC_String_1'Length then
|
Report.Failed("Not all of the characters on the first line " &
|
Report.Failed("Not all of the characters on the first line " &
|
"were processed");
|
"were processed");
|
end if;
|
end if;
|
|
|
|
|
-- Call procedure Skip_Line to advance beyond the end of the first line.
|
-- Call procedure Skip_Line to advance beyond the end of the first line.
|
|
|
Skip_Line(User_Defined_Input_File);
|
Skip_Line(User_Defined_Input_File);
|
|
|
|
|
-- Process the second line in the file (a blank line).
|
-- Process the second line in the file (a blank line).
|
|
|
Look_Ahead(User_Input_Ptr.all, UDLA_Char, UDLA_End_Of_Line);
|
Look_Ahead(User_Input_Ptr.all, UDLA_Char, UDLA_End_Of_Line);
|
|
|
if not UDLA_End_Of_Line then
|
if not UDLA_End_Of_Line then
|
Report.Failed("Incorrect end of line determination from procedure " &
|
Report.Failed("Incorrect end of line determination from procedure " &
|
"Look_Ahead when processing a blank line");
|
"Look_Ahead when processing a blank line");
|
end if;
|
end if;
|
|
|
-- Call procedure Skip_Line to advance beyond the end of the second line.
|
-- Call procedure Skip_Line to advance beyond the end of the second line.
|
|
|
Skip_Line(User_Input_Ptr.all);
|
Skip_Line(User_Input_Ptr.all);
|
|
|
|
|
-- Process characters in the third line of the file (second line
|
-- Process characters in the third line of the file (second line
|
-- of text)
|
-- of text)
|
-- Note: The version of Get_Immediate used in processing this line has
|
-- Note: The version of Get_Immediate used in processing this line has
|
-- the Boolean parameter Available.
|
-- the Boolean parameter Available.
|
|
|
Char_Pos := 1;
|
Char_Pos := 1;
|
|
|
-- Check whether the line is blank (i.e., at end of line, page, or file).
|
-- Check whether the line is blank (i.e., at end of line, page, or file).
|
|
|
Look_Ahead(User_Input_Ptr.all, UDLA_Char, UDLA_End_Of_Line);
|
Look_Ahead(User_Input_Ptr.all, UDLA_Char, UDLA_End_Of_Line);
|
|
|
while not UDLA_End_Of_Line loop
|
while not UDLA_End_Of_Line loop
|
|
|
-- Use the Get_Immediate procedure on the file to get access to the
|
-- Use the Get_Immediate procedure on the file to get access to the
|
-- next character on the current line.
|
-- next character on the current line.
|
|
|
Get_Immediate(User_Input_Ptr.all, UDGI_Char, UDGI_Available);
|
Get_Immediate(User_Input_Ptr.all, UDGI_Char, UDGI_Available);
|
|
|
-- Check that the Available parameter of Get_Immediate was set
|
-- Check that the Available parameter of Get_Immediate was set
|
-- to indicate that a character was available in the file.
|
-- to indicate that a character was available in the file.
|
-- Check that the characters returned by both procedures are the
|
-- Check that the characters returned by both procedures are the
|
-- same, and they all match the expected character from the file.
|
-- same, and they all match the expected character from the file.
|
|
|
if not UDGI_Available or
|
if not UDGI_Available or
|
UDLA_Char /= TC_String_Ptr_Array(2).all(Char_Pos) or
|
UDLA_Char /= TC_String_Ptr_Array(2).all(Char_Pos) or
|
UDGI_Char /= TC_String_Ptr_Array(2).all(Char_Pos)
|
UDGI_Char /= TC_String_Ptr_Array(2).all(Char_Pos)
|
then
|
then
|
Report.Failed("Incorrect retrieval of character " &
|
Report.Failed("Incorrect retrieval of character " &
|
Integer'Image(Char_Pos) & " of second string");
|
Integer'Image(Char_Pos) & " of second string");
|
end if;
|
end if;
|
|
|
-- Increment the character position counter.
|
-- Increment the character position counter.
|
|
|
Char_Pos := Char_Pos + 1;
|
Char_Pos := Char_Pos + 1;
|
|
|
-- Check the next character on the line. If at the end of line,
|
-- Check the next character on the line. If at the end of line,
|
-- the processing flow will exit the While loop.
|
-- the processing flow will exit the While loop.
|
|
|
Look_Ahead(User_Input_Ptr.all, UDLA_Char, UDLA_End_Of_Line);
|
Look_Ahead(User_Input_Ptr.all, UDLA_Char, UDLA_End_Of_Line);
|
|
|
end loop;
|
end loop;
|
|
|
-- Check to ensure that the "end of line" results returned from the
|
-- Check to ensure that the "end of line" results returned from the
|
-- Look_Ahead procedure (used to exit the above While loop) corresponds
|
-- Look_Ahead procedure (used to exit the above While loop) corresponds
|
-- with the result of Function End_Of_Line.
|
-- with the result of Function End_Of_Line.
|
|
|
if not End_Of_Line(User_Defined_Input_File)
|
if not End_Of_Line(User_Defined_Input_File)
|
then
|
then
|
Report.Failed("Result of procedure Look_Ahead that indicated " &
|
Report.Failed("Result of procedure Look_Ahead that indicated " &
|
"being at the end of the line does not correspond " &
|
"being at the end of the line does not correspond " &
|
"with the result of function End_Of_Line");
|
"with the result of function End_Of_Line");
|
end if;
|
end if;
|
|
|
-- Check that all characters in the second string were processed.
|
-- Check that all characters in the second string were processed.
|
|
|
if Char_Pos-1 /= TC_String_2'Length then
|
if Char_Pos-1 /= TC_String_2'Length then
|
Report.Failed("Not all of the characters on the second line " &
|
Report.Failed("Not all of the characters on the second line " &
|
"were processed");
|
"were processed");
|
end if;
|
end if;
|
|
|
|
|
Deletion:
|
Deletion:
|
begin
|
begin
|
-- Delete the user defined file.
|
-- Delete the user defined file.
|
|
|
if Is_Open(User_Defined_Input_File) then
|
if Is_Open(User_Defined_Input_File) then
|
Delete(User_Defined_Input_File);
|
Delete(User_Defined_Input_File);
|
else
|
else
|
Open(User_Defined_Input_File, Out_File, Report.Legal_File_Name(1));
|
Open(User_Defined_Input_File, Out_File, Report.Legal_File_Name(1));
|
Delete(User_Defined_Input_File);
|
Delete(User_Defined_Input_File);
|
end if;
|
end if;
|
exception
|
exception
|
when others =>
|
when others =>
|
Report.Failed
|
Report.Failed
|
( "Delete not properly implemented for Text_IO" );
|
( "Delete not properly implemented for Text_IO" );
|
end Deletion;
|
end Deletion;
|
|
|
|
|
exception
|
exception
|
|
|
when No_Reset =>
|
when No_Reset =>
|
null;
|
null;
|
|
|
when Non_Applicable_System =>
|
when Non_Applicable_System =>
|
Report.Not_Applicable("System not capable of supporting external " &
|
Report.Not_Applicable("System not capable of supporting external " &
|
"text files -- Name_Error/Use_Error raised " &
|
"text files -- Name_Error/Use_Error raised " &
|
"during text file creation");
|
"during text file creation");
|
when The_Error : others =>
|
when The_Error : others =>
|
Report.Failed ("The following exception was raised in the " &
|
Report.Failed ("The following exception was raised in the " &
|
"Test_Block: " & Exception_Name(The_Error));
|
"Test_Block: " & Exception_Name(The_Error));
|
end Test_Block;
|
end Test_Block;
|
|
|
Report.Result;
|
Report.Result;
|
|
|
end CXAA017;
|
end CXAA017;
|
|
|