-- CXB3012.A
|
-- CXB3012.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 Procedure Update modifies the value pointed to by
|
-- Check that Procedure Update modifies the value pointed to by
|
-- the chars_ptr parameter Item, starting at the position
|
-- the chars_ptr parameter Item, starting at the position
|
-- corresponding to parameter Offset, using the chars in
|
-- corresponding to parameter Offset, using the chars in
|
-- char_array parameter Chars.
|
-- char_array parameter Chars.
|
--
|
--
|
-- Check that the version of Procedure Update with a String parameter
|
-- Check that the version of Procedure Update with a String parameter
|
-- behaves in the manner described above, but with the character
|
-- behaves in the manner described above, but with the character
|
-- values in the String overwriting the char values in Item.
|
-- values in the String overwriting the char values in Item.
|
--
|
--
|
-- Check that both of the above versions of Procedure Update will
|
-- Check that both of the above versions of Procedure Update will
|
-- propagate Update_Error if Check is True, and if the length of
|
-- propagate Update_Error if Check is True, and if the length of
|
-- the new chars in Chars, when overlaid starting from position
|
-- the new chars in Chars, when overlaid starting from position
|
-- Offset, will overwrite the first nul in Item.
|
-- Offset, will overwrite the first nul in Item.
|
--
|
--
|
-- TEST DESCRIPTION:
|
-- TEST DESCRIPTION:
|
-- This test checks two versions of Procedure Update. In the first
|
-- This test checks two versions of Procedure Update. In the first
|
-- version of the procedure, the parameter Chars indicates a char_array
|
-- version of the procedure, the parameter Chars indicates a char_array
|
-- argument. These char_array parameters are provided through the use
|
-- argument. These char_array parameters are provided through the use
|
-- of the To_C function (with String IN parameter), both with and
|
-- of the To_C function (with String IN parameter), both with and
|
-- without a terminating nul. In the case below where a terminating nul
|
-- without a terminating nul. In the case below where a terminating nul
|
-- char is appended, the effect of "updating" the value pointed to by the
|
-- char is appended, the effect of "updating" the value pointed to by the
|
-- Item parameter will include its shortening, due to the insertion of
|
-- Item parameter will include its shortening, due to the insertion of
|
-- this additional nul in the middle of the char_array.
|
-- this additional nul in the middle of the char_array.
|
--
|
--
|
-- In the second version of Procedure Update evaluated here, the string
|
-- In the second version of Procedure Update evaluated here, the string
|
-- parameter Str is used to modify the char_array pointed to by Item.
|
-- parameter Str is used to modify the char_array pointed to by Item.
|
--
|
--
|
-- Finally, both versions of the procedure are evaluated to ensure that
|
-- Finally, both versions of the procedure are evaluated to ensure that
|
-- they propagate Update_Error and Dereference_Error under the proper
|
-- they propagate Update_Error and Dereference_Error under the proper
|
-- conditions.
|
-- conditions.
|
--
|
--
|
-- This test assumes that the following characters are all included
|
-- This test assumes that the following characters are all included
|
-- in the implementation defined type Interfaces.C.char:
|
-- in the implementation defined type Interfaces.C.char:
|
-- ' ', 'a'..'z', 'A'..'Z', '0'..'9', '-' and '.'.
|
-- ' ', 'a'..'z', 'A'..'Z', '0'..'9', '-' and '.'.
|
--
|
--
|
-- APPLICABILITY CRITERIA:
|
-- APPLICABILITY CRITERIA:
|
-- This test is applicable to all implementations that provide
|
-- This test is applicable to all implementations that provide
|
-- package Interfaces.C.Strings. If an implementation provides
|
-- package Interfaces.C.Strings. If an implementation provides
|
-- package Interfaces.C.Strings, this test must compile, execute,
|
-- package Interfaces.C.Strings, this test must compile, execute,
|
-- and report "PASSED".
|
-- and report "PASSED".
|
--
|
--
|
--
|
--
|
-- CHANGE HISTORY:
|
-- CHANGE HISTORY:
|
-- 05 Oct 95 SAIC Initial prerelease version.
|
-- 05 Oct 95 SAIC Initial prerelease version.
|
-- 13 May 96 SAIC Incorporated reviewer comments for ACVC 2.1.
|
-- 13 May 96 SAIC Incorporated reviewer comments for ACVC 2.1.
|
-- 26 Oct 96 SAIC Incorporated reviewer comments.
|
-- 26 Oct 96 SAIC Incorporated reviewer comments.
|
-- 14 Sep 99 RLB Removed incorrect and unnecessary
|
-- 14 Sep 99 RLB Removed incorrect and unnecessary
|
-- Unchecked_Conversion. Added check for raising
|
-- Unchecked_Conversion. Added check for raising
|
-- of Dereference_Error for Update (From Technical
|
-- of Dereference_Error for Update (From Technical
|
-- Corrigendum 1).
|
-- Corrigendum 1).
|
-- 07 Jan 05 RLB Modified to reflect change to Update by AI-242
|
-- 07 Jan 05 RLB Modified to reflect change to Update by AI-242
|
-- (which is expected to be part of Amendment 1).
|
-- (which is expected to be part of Amendment 1).
|
-- [This version allows either semantics.]
|
-- [This version allows either semantics.]
|
|
|
--!
|
--!
|
|
|
with Report;
|
with Report;
|
with Ada.Exceptions;
|
with Ada.Exceptions;
|
with Interfaces.C.Strings; -- N/A => ERROR
|
with Interfaces.C.Strings; -- N/A => ERROR
|
|
|
procedure CXB3012 is
|
procedure CXB3012 is
|
begin
|
begin
|
|
|
Report.Test ("CXB3012", "Check that both versions of Procedure Update " &
|
Report.Test ("CXB3012", "Check that both versions of Procedure Update " &
|
"produce correct results");
|
"produce correct results");
|
|
|
Test_Block:
|
Test_Block:
|
declare
|
declare
|
|
|
package IC renames Interfaces.C;
|
package IC renames Interfaces.C;
|
package ICS renames Interfaces.C.Strings;
|
package ICS renames Interfaces.C.Strings;
|
use Ada.Exceptions;
|
use Ada.Exceptions;
|
|
|
use type IC.char;
|
use type IC.char;
|
use type IC.char_array;
|
use type IC.char_array;
|
use type IC.size_t;
|
use type IC.size_t;
|
use type ICS.chars_ptr;
|
use type ICS.chars_ptr;
|
|
|
TC_String_1 : String(1..1) := "J";
|
TC_String_1 : String(1..1) := "J";
|
TC_String_2 : String(1..2) := "Ab";
|
TC_String_2 : String(1..2) := "Ab";
|
TC_String_3 : String(1..3) := "xyz";
|
TC_String_3 : String(1..3) := "xyz";
|
TC_String_4 : String(1..4) := "ACVC";
|
TC_String_4 : String(1..4) := "ACVC";
|
TC_String_5 : String(1..5) := "1a2b3";
|
TC_String_5 : String(1..5) := "1a2b3";
|
TC_String_6 : String(1..6) := "---...";
|
TC_String_6 : String(1..6) := "---...";
|
TC_String_7 : String(1..7) := "AABBBAA";
|
TC_String_7 : String(1..7) := "AABBBAA";
|
TC_String_8 : String(1..8) := "aBcDeFgH";
|
TC_String_8 : String(1..8) := "aBcDeFgH";
|
TC_String_9 : String(1..9) := "JustATest";
|
TC_String_9 : String(1..9) := "JustATest";
|
TC_String_10 : String(1..10) := "0123456789";
|
TC_String_10 : String(1..10) := "0123456789";
|
|
|
TC_Result_String_1 : constant String := "JXXXXXXXXX";
|
TC_Result_String_1 : constant String := "JXXXXXXXXX";
|
TC_Result_String_2 : constant String := "XXXXXXXXAb";
|
TC_Result_String_2 : constant String := "XXXXXXXXAb";
|
TC_Result_String_3 : constant String := "XXXxyz";
|
TC_Result_String_3 : constant String := "XXXxyz";
|
TC_Result_String_4 : constant String := "XACVC";
|
TC_Result_String_4 : constant String := "XACVC";
|
TC_Result_String_5 : constant String := "1a2b3";
|
TC_Result_String_5 : constant String := "1a2b3";
|
TC_Result_String_6 : constant String := "XXX---...";
|
TC_Result_String_6 : constant String := "XXX---...";
|
|
|
TC_Amd_Result_String_4 :
|
TC_Amd_Result_String_4 :
|
constant String := "XACVCXXXXX";
|
constant String := "XACVCXXXXX";
|
TC_Amd_Result_String_5 :
|
TC_Amd_Result_String_5 :
|
constant String := "1a2b3XXXXX";
|
constant String := "1a2b3XXXXX";
|
TC_Amd_Result_String_6 :
|
TC_Amd_Result_String_6 :
|
constant String := "XXX---...X";
|
constant String := "XXX---...X";
|
TC_Amd_Result_String_9 :
|
TC_Amd_Result_String_9 :
|
constant String := "JustATestX";
|
constant String := "JustATestX";
|
|
|
TC_char_array : IC.char_array(0..10) := IC.To_C("XXXXXXXXXX");
|
TC_char_array : IC.char_array(0..10) := IC.To_C("XXXXXXXXXX");
|
TC_Result_char_array : IC.char_array(0..10) := IC.To_C("XXXXXXXXXX");
|
TC_Result_char_array : IC.char_array(0..10) := IC.To_C("XXXXXXXXXX");
|
TC_chars_ptr : ICS.chars_ptr;
|
TC_chars_ptr : ICS.chars_ptr;
|
TC_Length : IC.size_t;
|
TC_Length : IC.size_t;
|
|
|
begin
|
begin
|
|
|
-- Check that Procedure Update modifies the value pointed to by
|
-- Check that Procedure Update modifies the value pointed to by
|
-- the chars_ptr parameter Item, starting at the position
|
-- the chars_ptr parameter Item, starting at the position
|
-- corresponding to parameter Offset, using the chars in
|
-- corresponding to parameter Offset, using the chars in
|
-- char_array parameter Chars.
|
-- char_array parameter Chars.
|
-- Note: If parameter Chars contains a nul char (such as a
|
-- Note: If parameter Chars contains a nul char (such as a
|
-- terminating nul), the result may be the overall shortening
|
-- terminating nul), the result may be the overall shortening
|
-- of parameter Item.
|
-- of parameter Item.
|
|
|
TC_chars_ptr := ICS.New_Char_Array(TC_char_array);
|
TC_chars_ptr := ICS.New_Char_Array(TC_char_array);
|
|
|
ICS.Update(Item => TC_chars_ptr,
|
ICS.Update(Item => TC_chars_ptr,
|
Offset => 0,
|
Offset => 0,
|
Chars => IC.To_C(TC_String_1, False), -- No nul char.
|
Chars => IC.To_C(TC_String_1, False), -- No nul char.
|
Check => True);
|
Check => True);
|
|
|
if ICS.Value(TC_chars_ptr) /= TC_Result_String_1 then
|
if ICS.Value(TC_chars_ptr) /= TC_Result_String_1 then
|
Report.Failed("Incorrect result from Procedure Update - 1");
|
Report.Failed("Incorrect result from Procedure Update - 1");
|
end if;
|
end if;
|
ICS.Free(TC_chars_ptr);
|
ICS.Free(TC_chars_ptr);
|
|
|
|
|
TC_chars_ptr := ICS.New_Char_Array(TC_char_array);
|
TC_chars_ptr := ICS.New_Char_Array(TC_char_array);
|
ICS.Update(TC_chars_ptr,
|
ICS.Update(TC_chars_ptr,
|
Offset => ICS.Strlen(TC_chars_ptr) - 2,
|
Offset => ICS.Strlen(TC_chars_ptr) - 2,
|
Chars => IC.To_C(TC_String_2, False), -- No nul char.
|
Chars => IC.To_C(TC_String_2, False), -- No nul char.
|
Check => True);
|
Check => True);
|
|
|
if ICS.Value(TC_chars_ptr) /= TC_Result_String_2 then
|
if ICS.Value(TC_chars_ptr) /= TC_Result_String_2 then
|
Report.Failed("Incorrect result from Procedure Update - 2");
|
Report.Failed("Incorrect result from Procedure Update - 2");
|
end if;
|
end if;
|
ICS.Free(TC_chars_ptr);
|
ICS.Free(TC_chars_ptr);
|
|
|
|
|
TC_chars_ptr := ICS.New_Char_Array(TC_char_array);
|
TC_chars_ptr := ICS.New_Char_Array(TC_char_array);
|
ICS.Update(TC_chars_ptr,
|
ICS.Update(TC_chars_ptr,
|
3,
|
3,
|
Chars => IC.To_C(TC_String_3), -- Nul appended, shortens
|
Chars => IC.To_C(TC_String_3), -- Nul appended, shortens
|
Check => False); -- array.
|
Check => False); -- array.
|
|
|
if ICS.Value(TC_chars_ptr) /= TC_Result_String_3 then
|
if ICS.Value(TC_chars_ptr) /= TC_Result_String_3 then
|
Report.Failed("Incorrect result from Procedure Update - 3");
|
Report.Failed("Incorrect result from Procedure Update - 3");
|
end if;
|
end if;
|
ICS.Free(TC_chars_ptr);
|
ICS.Free(TC_chars_ptr);
|
|
|
|
|
TC_chars_ptr := ICS.New_Char_Array(TC_char_array);
|
TC_chars_ptr := ICS.New_Char_Array(TC_char_array);
|
ICS.Update(TC_chars_ptr,
|
ICS.Update(TC_chars_ptr,
|
0,
|
0,
|
IC.To_C(TC_String_10), -- Complete replacement of array.
|
IC.To_C(TC_String_10), -- Complete replacement of array.
|
Check => False);
|
Check => False);
|
|
|
if ICS.Value(TC_chars_ptr) /= TC_String_10 then
|
if ICS.Value(TC_chars_ptr) /= TC_String_10 then
|
Report.Failed("Incorrect result from Procedure Update - 4");
|
Report.Failed("Incorrect result from Procedure Update - 4");
|
end if;
|
end if;
|
|
|
-- Perform a character-by-character comparison of the result of
|
-- Perform a character-by-character comparison of the result of
|
-- Procedure Update. Note that char_array lower bound is 0, and
|
-- Procedure Update. Note that char_array lower bound is 0, and
|
-- that the nul char is not compared with any character in the
|
-- that the nul char is not compared with any character in the
|
-- string (since the string is not nul terminated).
|
-- string (since the string is not nul terminated).
|
begin
|
begin
|
TC_Length := ICS.Strlen(TC_chars_ptr);
|
TC_Length := ICS.Strlen(TC_chars_ptr);
|
TC_Result_char_array(0..10) := ICS.Value(TC_chars_ptr);
|
TC_Result_char_array(0..10) := ICS.Value(TC_chars_ptr);
|
for i in 0..TC_Length-1 loop
|
for i in 0..TC_Length-1 loop
|
if TC_Result_char_array(i) /=
|
if TC_Result_char_array(i) /=
|
IC.To_C(TC_String_10(Integer(i+1)))
|
IC.To_C(TC_String_10(Integer(i+1)))
|
then
|
then
|
Report.Failed("Incorrect result from the character-by-" &
|
Report.Failed("Incorrect result from the character-by-" &
|
"character evaluation of the result of " &
|
"character evaluation of the result of " &
|
"Procedure Update");
|
"Procedure Update");
|
end if;
|
end if;
|
end loop;
|
end loop;
|
exception
|
exception
|
when others =>
|
when others =>
|
Report.Failed("Exception raised during the character-by-" &
|
Report.Failed("Exception raised during the character-by-" &
|
"character evaluation of the result of " &
|
"character evaluation of the result of " &
|
"Procedure Update");
|
"Procedure Update");
|
end;
|
end;
|
ICS.Free(TC_chars_ptr);
|
ICS.Free(TC_chars_ptr);
|
|
|
|
|
|
|
-- Check that the version of Procedure Update with a String rather
|
-- Check that the version of Procedure Update with a String rather
|
-- than a char_array parameter behaves in the manner described above,
|
-- than a char_array parameter behaves in the manner described above,
|
-- but with the character values in the String overwriting the char
|
-- but with the character values in the String overwriting the char
|
-- values in Item.
|
-- values in Item.
|
--
|
--
|
-- Note: In Ada 95, In each of the cases below, the String parameter
|
-- Note: In Ada 95, In each of the cases below, the String parameter
|
-- Str is treated as if it were nul terminated, which means that
|
-- Str is treated as if it were nul terminated, which means that
|
-- the char_array pointed to by TC_chars_ptr will be "shortened"
|
-- the char_array pointed to by TC_chars_ptr will be "shortened"
|
-- so that it ends after the last character of the Str
|
-- so that it ends after the last character of the Str
|
-- parameter. For Ada 2005, this rule is dropped, so the
|
-- parameter. For Ada 2005, this rule is dropped, so the
|
-- number of characters remains the same.
|
-- number of characters remains the same.
|
|
|
TC_chars_ptr := ICS.New_Char_Array(TC_char_array);
|
TC_chars_ptr := ICS.New_Char_Array(TC_char_array);
|
ICS.Update(TC_chars_ptr, 1, TC_String_4, False);
|
ICS.Update(TC_chars_ptr, 1, TC_String_4, False);
|
|
|
if ICS.Value(TC_chars_ptr) = TC_Result_String_4 then
|
if ICS.Value(TC_chars_ptr) = TC_Result_String_4 then
|
Report.Comment("Ada 95 result from Procedure Update - 5");
|
Report.Comment("Ada 95 result from Procedure Update - 5");
|
elsif ICS.Value(TC_chars_ptr) = TC_Amd_Result_String_4 then
|
elsif ICS.Value(TC_chars_ptr) = TC_Amd_Result_String_4 then
|
Report.Comment("Amendment 1 result from Procedure Update - 5");
|
Report.Comment("Amendment 1 result from Procedure Update - 5");
|
else
|
else
|
Report.Failed("Incorrect result from Procedure Update - 5");
|
Report.Failed("Incorrect result from Procedure Update - 5");
|
end if;
|
end if;
|
ICS.Free(TC_chars_ptr);
|
ICS.Free(TC_chars_ptr);
|
|
|
|
|
TC_chars_ptr := ICS.New_Char_Array(TC_char_array);
|
TC_chars_ptr := ICS.New_Char_Array(TC_char_array);
|
ICS.Update(Item => TC_chars_ptr,
|
ICS.Update(Item => TC_chars_ptr,
|
Offset => 0,
|
Offset => 0,
|
Str => TC_String_5);
|
Str => TC_String_5);
|
|
|
if ICS.Value(TC_chars_ptr) = TC_Result_String_5 then
|
if ICS.Value(TC_chars_ptr) = TC_Result_String_5 then
|
Report.Comment("Ada 95 result from Procedure Update - 6");
|
Report.Comment("Ada 95 result from Procedure Update - 6");
|
elsif ICS.Value(TC_chars_ptr) = TC_Amd_Result_String_5 then
|
elsif ICS.Value(TC_chars_ptr) = TC_Amd_Result_String_5 then
|
Report.Comment("Amendment 1 result from Procedure Update - 6");
|
Report.Comment("Amendment 1 result from Procedure Update - 6");
|
else
|
else
|
Report.Failed("Incorrect result from Procedure Update - 6");
|
Report.Failed("Incorrect result from Procedure Update - 6");
|
end if;
|
end if;
|
ICS.Free(TC_chars_ptr);
|
ICS.Free(TC_chars_ptr);
|
|
|
|
|
TC_chars_ptr := ICS.New_Char_Array(TC_char_array);
|
TC_chars_ptr := ICS.New_Char_Array(TC_char_array);
|
ICS.Update(TC_chars_ptr,
|
ICS.Update(TC_chars_ptr,
|
3,
|
3,
|
Str => TC_String_6,
|
Str => TC_String_6,
|
Check => True);
|
Check => True);
|
|
|
if ICS.Value(TC_chars_ptr) = TC_Result_String_6 then
|
if ICS.Value(TC_chars_ptr) = TC_Result_String_6 then
|
Report.Comment("Ada 95 result from Procedure Update - 7");
|
Report.Comment("Ada 95 result from Procedure Update - 7");
|
elsif ICS.Value(TC_chars_ptr) = TC_Amd_Result_String_6 then
|
elsif ICS.Value(TC_chars_ptr) = TC_Amd_Result_String_6 then
|
Report.Comment("Amendment 1 result from Procedure Update - 7");
|
Report.Comment("Amendment 1 result from Procedure Update - 7");
|
else
|
else
|
Report.Failed("Incorrect result from Procedure Update - 7");
|
Report.Failed("Incorrect result from Procedure Update - 7");
|
end if;
|
end if;
|
ICS.Free(TC_chars_ptr);
|
ICS.Free(TC_chars_ptr);
|
|
|
|
|
TC_chars_ptr := ICS.New_Char_Array(TC_char_array);
|
TC_chars_ptr := ICS.New_Char_Array(TC_char_array);
|
ICS.Update(TC_chars_ptr, 0, TC_String_9, True);
|
ICS.Update(TC_chars_ptr, 0, TC_String_9, True);
|
|
|
if ICS.Value(TC_chars_ptr) = TC_String_9 then
|
if ICS.Value(TC_chars_ptr) = TC_String_9 then
|
Report.Comment("Ada 95 result from Procedure Update - 8");
|
Report.Comment("Ada 95 result from Procedure Update - 8");
|
elsif ICS.Value(TC_chars_ptr) = TC_Amd_Result_String_9 then
|
elsif ICS.Value(TC_chars_ptr) = TC_Amd_Result_String_9 then
|
Report.Comment("Amendment 1 result from Procedure Update - 8");
|
Report.Comment("Amendment 1 result from Procedure Update - 8");
|
else
|
else
|
Report.Failed("Incorrect result from Procedure Update - 8");
|
Report.Failed("Incorrect result from Procedure Update - 8");
|
end if;
|
end if;
|
ICS.Free(TC_chars_ptr);
|
ICS.Free(TC_chars_ptr);
|
|
|
-- Check what happens if the string and array are the same size (this
|
-- Check what happens if the string and array are the same size (this
|
-- is the case that caused the change made by the Amendment).
|
-- is the case that caused the change made by the Amendment).
|
begin
|
begin
|
TC_chars_ptr := ICS.New_Char_Array(TC_char_array);
|
TC_chars_ptr := ICS.New_Char_Array(TC_char_array);
|
ICS.Update(Item => TC_chars_ptr,
|
ICS.Update(Item => TC_chars_ptr,
|
Offset => 0,
|
Offset => 0,
|
Str => TC_String_10,
|
Str => TC_String_10,
|
Check => True);
|
Check => True);
|
if ICS.Value(TC_chars_ptr) = TC_String_10 then
|
if ICS.Value(TC_chars_ptr) = TC_String_10 then
|
Report.Comment("Amendment 1 result from Procedure Update - 9");
|
Report.Comment("Amendment 1 result from Procedure Update - 9");
|
else
|
else
|
Report.Failed("Incorrect result from Procedure Update - 9");
|
Report.Failed("Incorrect result from Procedure Update - 9");
|
end if;
|
end if;
|
exception
|
exception
|
when ICS.Update_Error =>
|
when ICS.Update_Error =>
|
Report.Comment("Ada 95 exception expected from Procedure Update - 9");
|
Report.Comment("Ada 95 exception expected from Procedure Update - 9");
|
when others =>
|
when others =>
|
Report.Failed("Incorrect exception raised by Procedure Update " &
|
Report.Failed("Incorrect exception raised by Procedure Update " &
|
"with Str parameter - 9");
|
"with Str parameter - 9");
|
end;
|
end;
|
ICS.Free(TC_chars_ptr);
|
ICS.Free(TC_chars_ptr);
|
|
|
|
|
-- Check that both of the above versions of Procedure Update will
|
-- Check that both of the above versions of Procedure Update will
|
-- propagate Update_Error if Check is True, and if the length of
|
-- propagate Update_Error if Check is True, and if the length of
|
-- the new chars in Chars, when overlaid starting from position
|
-- the new chars in Chars, when overlaid starting from position
|
-- Offset, will overwrite the first nul in Item.
|
-- Offset, will overwrite the first nul in Item.
|
|
|
begin
|
begin
|
TC_chars_ptr := ICS.New_Char_Array(TC_char_array);
|
TC_chars_ptr := ICS.New_Char_Array(TC_char_array);
|
ICS.Update(Item => TC_chars_ptr,
|
ICS.Update(Item => TC_chars_ptr,
|
Offset => 5,
|
Offset => 5,
|
Chars => IC.To_C(TC_String_7),
|
Chars => IC.To_C(TC_String_7),
|
Check => True);
|
Check => True);
|
Report.Failed("Update_Error not raised by Procedure Update with " &
|
Report.Failed("Update_Error not raised by Procedure Update with " &
|
"Chars parameter");
|
"Chars parameter");
|
Report.Comment(ICS.Value(TC_chars_ptr) & "used here to defeat " &
|
Report.Comment(ICS.Value(TC_chars_ptr) & "used here to defeat " &
|
"optimization - should never be printed");
|
"optimization - should never be printed");
|
exception
|
exception
|
when ICS.Update_Error => null; -- OK, expected exception.
|
when ICS.Update_Error => null; -- OK, expected exception.
|
when others =>
|
when others =>
|
Report.Failed("Incorrect exception raised by Procedure Update " &
|
Report.Failed("Incorrect exception raised by Procedure Update " &
|
"with Chars parameter");
|
"with Chars parameter");
|
end;
|
end;
|
|
|
ICS.Free(TC_chars_ptr);
|
ICS.Free(TC_chars_ptr);
|
|
|
begin
|
begin
|
TC_chars_ptr := ICS.New_Char_Array(TC_char_array);
|
TC_chars_ptr := ICS.New_Char_Array(TC_char_array);
|
ICS.Update(Item => TC_chars_ptr,
|
ICS.Update(Item => TC_chars_ptr,
|
Offset => ICS.Strlen(TC_chars_ptr),
|
Offset => ICS.Strlen(TC_chars_ptr),
|
Str => TC_String_8); -- Default Check parameter value.
|
Str => TC_String_8); -- Default Check parameter value.
|
Report.Failed("Update_Error not raised by Procedure Update with " &
|
Report.Failed("Update_Error not raised by Procedure Update with " &
|
"Str parameter");
|
"Str parameter");
|
Report.Comment(ICS.Value(TC_chars_ptr) & "used here to defeat " &
|
Report.Comment(ICS.Value(TC_chars_ptr) & "used here to defeat " &
|
"optimization - should never be printed");
|
"optimization - should never be printed");
|
exception
|
exception
|
when ICS.Update_Error => null; -- OK, expected exception.
|
when ICS.Update_Error => null; -- OK, expected exception.
|
when others =>
|
when others =>
|
Report.Failed("Incorrect exception raised by Procedure Update " &
|
Report.Failed("Incorrect exception raised by Procedure Update " &
|
"with Str parameter");
|
"with Str parameter");
|
end;
|
end;
|
|
|
ICS.Free(TC_chars_ptr);
|
ICS.Free(TC_chars_ptr);
|
|
|
-- Check that both of the above versions of Procedure Update will
|
-- Check that both of the above versions of Procedure Update will
|
-- propagate Dereference_Error if Item is Null_Ptr.
|
-- propagate Dereference_Error if Item is Null_Ptr.
|
-- Note: Free sets TC_chars_ptr to Null_Ptr.
|
-- Note: Free sets TC_chars_ptr to Null_Ptr.
|
|
|
begin
|
begin
|
ICS.Update(Item => TC_chars_ptr,
|
ICS.Update(Item => TC_chars_ptr,
|
Offset => 5,
|
Offset => 5,
|
Chars => IC.To_C(TC_String_7),
|
Chars => IC.To_C(TC_String_7),
|
Check => True);
|
Check => True);
|
Report.Failed("Dereference_Error not raised by Procedure Update with " &
|
Report.Failed("Dereference_Error not raised by Procedure Update with " &
|
"Chars parameter");
|
"Chars parameter");
|
exception
|
exception
|
when ICS.Dereference_Error => null; -- OK, expected exception.
|
when ICS.Dereference_Error => null; -- OK, expected exception.
|
when others =>
|
when others =>
|
Report.Failed("Incorrect exception raised by Procedure Update " &
|
Report.Failed("Incorrect exception raised by Procedure Update " &
|
"with Chars parameter");
|
"with Chars parameter");
|
end;
|
end;
|
|
|
begin
|
begin
|
ICS.Update(Item => TC_chars_ptr,
|
ICS.Update(Item => TC_chars_ptr,
|
Offset => ICS.Strlen(TC_chars_ptr),
|
Offset => ICS.Strlen(TC_chars_ptr),
|
Str => TC_String_8); -- Default Check parameter value.
|
Str => TC_String_8); -- Default Check parameter value.
|
Report.Failed("Dereference_Error not raised by Procedure Update with " &
|
Report.Failed("Dereference_Error not raised by Procedure Update with " &
|
"Str parameter");
|
"Str parameter");
|
exception
|
exception
|
when ICS.Dereference_Error => null; -- OK, expected exception.
|
when ICS.Dereference_Error => null; -- OK, expected exception.
|
when others =>
|
when others =>
|
Report.Failed("Incorrect exception raised by Procedure Update " &
|
Report.Failed("Incorrect exception raised by Procedure Update " &
|
"with Str parameter");
|
"with Str parameter");
|
end;
|
end;
|
|
|
exception
|
exception
|
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 CXB3012;
|
end CXB3012;
|
|
|