DataMuseum.dk

Presents historical artifacts from the history of:

Rational R1000/400 Tapes

This is an automatic "excavation" of a thematic subset of
artifacts from Datamuseum.dk's BitArchive.

See our Wiki for more about Rational R1000/400 Tapes

Excavated with: AutoArchaeologist - Free & Open Source Software.


top - download
Index: ┃ B T

⟦f85c075a1⟧ TextFile

    Length: 7929 (0x1ef9)
    Types: TextFile
    Names: »B«

Derivation

└─⟦85b835f43⟧ Bits:30000549 8mm tape, Rational 1000, Xlib rev 6.00
    └─ ⟦0c20f784e⟧ »DATA« 
        └─⟦1abbe589f⟧ 
            └─⟦49e7f20b9⟧ 
                └─⟦this⟧ 

TextFile

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;