|
|
DataMuseum.dkPresents historical artifacts from the history of: Rational R1000/400 |
This is an automatic "excavation" of a thematic subset of
See our Wiki for more about Rational R1000/400 Excavated with: AutoArchaeologist - Free & Open Source Software. |
top - metrics - download
Length: 11264 (0x2c00)
Types: Ada Source
Notes: 03_class, FILE, R1k_Segment, e3_tag, procedure Cvt_110, seg_0054bd
└─⟦8527c1e9b⟧ Bits:30000544 8mm tape, Rational 1000, Arrival backup of disks in PAM's R1000
└─⟦5a81ac88f⟧ »Space Info Vol 1«
└─⟦this⟧
with Test_Io;
with Cvt_Test_Utilities;
with Xlbt_Arithmetic;
with Xlbt_String;
procedure Cvt_110 is
------------------------------------------------------------------------------
-- Tests for Xlbt_String conversions
------------------------------------------------------------------------------
-- 09/25/90 DRK | Created.
------------------------------------------------------------------------------
---------------------------------
-- Handy constants and renames --
---------------------------------
package Utils renames Cvt_Test_Utilities;
package Tests renames Utils.X_String_Tests;
package Dummy renames Utils.Dummy_Converters;
----------------------------------------------------------------------
-------------------------
-- Major test sections --
-------------------------
procedure Test_String_Func is
procedure To_Str8 (Str8 : out Xlbt_String.X_String; Str7 : String) is
begin
Str8 := Xlbt_String.To_X_String (Str7);
end To_Str8;
--
procedure From_Str8 (Str7 : out String; Str8 : Xlbt_String.X_String) is
begin
Str7 := Xlbt_String.To_String (Str8);
end From_Str8;
--
procedure Test is new Tests.Tester_1d (Character, Positive, String,
"String", To_Str8, From_Str8);
procedure Dummy_To_Str8 is
new Dummy.Convert_From_Array
(Character, Positive, String, Xlbt_String.X_String);
--
procedure Test_Chop is new Tests.Tester_1d
(Character, Positive, String,
"String", Dummy_To_Str8, From_Str8);
use Xlbt_String;
begin
Test_Io.Section ("String function conversions");
Test ("1..0 => 0", (1 .. 0 => Ascii.Nul), (1 .. 0 => Xlbt_String.Nul));
Test ("2..2 => 127", (2 => Ascii.Del), (1 => Xlbt_String.Del));
Test ("Abc", "Abc", "Abc");
-- Verify that high bits are chopped in Str8 data.
Test_Chop ("big-chars", Ascii.Nul & Ascii.Del & '+' & Ascii.Del,
Xlbt_String.C128 & Xlbt_String.Del &
Xlbt_String.C171 & Xlbt_String.C255);
Test_Io.New_Line;
end Test_String_Func;
-- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- --
procedure Test_String_Trans_Func is
Trans : Xlbt_String.X_Translation_Array := (others => '?');
procedure To_Str8 (Str8 : out Xlbt_String.X_String; Str7 : String) is
begin
Str8 := Xlbt_String.To_X_String (Str7);
end To_Str8;
--
procedure Trans_From_Str8 (Str7 : out String;
Str8 : Xlbt_String.X_String) is
begin
Str7 := Xlbt_String.To_String (Str8, Trans);
end Trans_From_Str8;
--
procedure Test is new Tests.Tester_1d
(Character, Positive, String,
"String", To_Str8, Trans_From_Str8);
procedure Dummy_To_Str8 is
new Dummy.Convert_From_Array
(Character, Positive, String, Xlbt_String.X_String);
--
procedure Test_Trans is new Tests.Tester_1d
(Character, Positive, String, "String",
Dummy_To_Str8, Trans_From_Str8);
use Xlbt_String;
begin
Test_Io.Section ("String translation function conversions");
-- Let normal characters translate normally.
for I in Character'First .. Character'Last loop
Trans (Xlbt_String.X_Character'Val (Character'Pos (I))) := I;
end loop;
-- Test normal translations.
Test ("1..0 => 0", (1 .. 0 => Ascii.Nul), (1 .. 0 => Xlbt_String.Nul));
Test ("2..2 => 127", (2 => Ascii.Del), (1 => Xlbt_String.Del));
Test ("Abc", "Abc", "Abc");
-- Verify that translation works.
Trans (Xlbt_String.C128) := 'w';
Trans (Xlbt_String.Del) := 'x';
Trans (Xlbt_String.C171) := 'y';
Trans (Xlbt_String.C255) := 'z';
Test_Trans ("big-chars", "<wxyz>",
'<' & Xlbt_String.C128 & Xlbt_String.Del &
Xlbt_String.C171 & Xlbt_String.C255 & '>');
Test_Io.New_Line;
end Test_String_Trans_Func;
-- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- --
procedure Test_String is
procedure Test is new Tests.Tester_1d
(Character, Positive, String,
"String", Xlbt_String.To_X_String,
Xlbt_String.To_String);
procedure Dummy_To_Str8 is
new Dummy.Convert_From_Array
(Character, Positive, String, Xlbt_String.X_String);
procedure Test_Chop is new Tests.Tester_1d
(Character, Positive, String, "String",
Dummy_To_Str8, Xlbt_String.To_String);
use Xlbt_String;
begin
Test_Io.Section ("String conversions");
Test ("1..0 => 0", (1 .. 0 => Ascii.Nul), (1 .. 0 => Xlbt_String.Nul));
Test ("2..2 => 127", (2 => Ascii.Del), (1 => Xlbt_String.Del));
Test ("Abc", "Abc", "Abc");
-- Verify that high bits are chopped in Str8 data.
Test_Chop ("big-chars", Ascii.Nul & Ascii.Del & '+' & Ascii.Del,
Xlbt_String.C128 & Xlbt_String.Del &
Xlbt_String.C171 & Xlbt_String.C255);
Test_Io.New_Line;
end Test_String;
-- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- --
procedure Test_String_Trans is
Trans : Xlbt_String.X_Translation_Array := (others => '?');
procedure Trans_From_Str8 (Str7 : out String;
Str8 : Xlbt_String.X_String) is
begin
Xlbt_String.To_String (Str7, Str8, Trans);
end Trans_From_Str8;
--
procedure Test is new Tests.Tester_1d
(Character, Positive, String, "String",
Xlbt_String.To_X_String, Trans_From_Str8);
procedure Dummy_To_Str8 is
new Dummy.Convert_From_Array
(Character, Positive, String, Xlbt_String.X_String);
--
procedure Test_Trans is new Tests.Tester_1d
(Character, Positive, String, "String",
Dummy_To_Str8, Trans_From_Str8);
use Xlbt_String;
begin
Test_Io.Section ("String translation conversions");
-- Let normal characters translate normally.
for I in Character'First .. Character'Last loop
Trans (Xlbt_String.X_Character'Val (Character'Pos (I))) := I;
end loop;
-- Test normal translations.
Test ("1..0 => 0", (1 .. 0 => Ascii.Nul), (1 .. 0 => Xlbt_String.Nul));
Test ("2..2 => 127", (2 => Ascii.Del), (1 => Xlbt_String.Del));
Test ("Abc", "Abc", "Abc");
-- Verify that translation works.
Trans (Xlbt_String.C128) := 'w';
Trans (Xlbt_String.Del) := 'x';
Trans (Xlbt_String.C171) := 'y';
Trans (Xlbt_String.C255) := 'z';
Test_Trans ("big-chars", "<wxyz>",
'<' & Xlbt_String.C128 & Xlbt_String.Del &
Xlbt_String.C171 & Xlbt_String.C255 & '>');
Test_Io.New_Line;
end Test_String_Trans;
begin
Test_String_Func;
Test_String_Trans_Func;
Test_String;
Test_String_Trans;
end Cvt_110;
nblk1=a
nid=0
hdr6=14
[0x00] rec0=1f rec1=00 rec2=01 rec3=09c
[0x01] rec0=18 rec1=00 rec2=02 rec3=082
[0x02] rec0=18 rec1=00 rec2=03 rec3=024
[0x03] rec0=18 rec1=00 rec2=04 rec3=024
[0x04] rec0=16 rec1=00 rec2=05 rec3=020
[0x05] rec0=00 rec1=00 rec2=0a rec3=002
[0x06] rec0=15 rec1=00 rec2=06 rec3=00a
[0x07] rec0=17 rec1=00 rec2=07 rec3=042
[0x08] rec0=17 rec1=00 rec2=08 rec3=088
[0x09] rec0=0a rec1=00 rec2=09 rec3=000
tail 0x21500a17e81978a700436 0x42a00088462063203