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

⟦a05d52ee6⟧ TextFile

    Length: 28691 (0x7013)
    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_Basic;  
with Xlbt_Font;  
with Xlbt_Font3;  
with Xlbt_Key;  
with Xlbt_Key3;  
with Xlbt_Keyboard;  
with Xlbt_Misc;  
with Xlbt_Pointer;  
with Xlbt_String;  
with Xlbt_String16;  
with Xlbmt_Network_Types;

with Xlbip_Base_Converters;

procedure Cvt_020 is
------------------------------------------------------------------------------
-- Tests for Xlbip_Base_Converters
--
-- Xlbip_Base_Converters only instantiates the converters actually used
-- by the protocol.  The Tester generics expect to have symmetric
-- converters for each type.  Individual tests instantiate their own
-- dummy To_Raw and From_Raw converters when necessary.
------------------------------------------------------------------------------
-- 09/10/90 DRK     | Created.
------------------------------------------------------------------------------

    ---------------------------------
    -- Handy constants and renames --
    ---------------------------------

    package Utils renames Cvt_Test_Utilities;  
    package Tests renames Utils.Raw_Data_Tests;  
    package Dummy renames Utils.Dummy_Converters;  
    use Utils.Raw_Data_Constants;

    ----------------------------------------------------------------------

    -------------------------
    -- Major test sections --
    -------------------------

    procedure Test_X_Atom_Array is  
        procedure Test is new Tests.Tester_1d  
                                 (Xlbt_Basic.X_Atom, Xlbt_Arithmetic.S_Natural,  
                                  Xlbt_Basic.X_Atom_Array, "X_Atom_Array",  
                                  Xlbip_Base_Converters.To_Raw,  
                                  Xlbip_Base_Converters.From_Raw);  
    begin  
        Test_Io.Section ("X_Atom_Array conversions");  
        Test ("1..0 => 0", (1 .. 0 => (Number => 0)), (1 .. 0 => 0));  
        Test ("1..1 => -1", (1 => (Number => Minus_1)), (1 .. 4 => Raw_Ff));  
        Test ("0..0 => 2", (0 => (Number => 2)), Swab_00_00_00_02);  
        Test ("1..2 => 1", (1 .. 2 => (Number => 1)),  
              Swab_00_00_00_01 & Swab_00_00_00_01);  
        Test_Io.New_Line;  
    end Test_X_Atom_Array;

    --  --  --  --  --  --  --  --  --  --  --  --  --  --  --  --  --  --

    procedure Test_X_Char_Struct is  
        procedure To_Raw is new Dummy.Convert_From_Private  
                                   (Xlbt_Font.X_Char_Struct,  
                                    Xlbmt_Network_Types.X_Raw_Data_Array);  
        procedure Test   is new Tests.Tester  
                                   (Xlbt_Font.X_Char_Struct, "X_Char_Struct",  
                                    To_Raw, Xlbip_Base_Converters.From_Raw);  
    begin  
        Test_Io.Section ("X_Char_Struct conversions");  
        Test ("0", (0, 0, 0, 0, 0, (others => False)), (1 .. 12 => 0));  
        Test ("-1", (Minus_1, Minus_1, Minus_1, Minus_1,  
                     Minus_1, (others => True)), (1 .. 12 => Raw_Ff));  
        Test ("1, 2, 3, 4, 5, 6",  
              (1, 2, 3, 4, 5, (Xlbt_Font.Xpcfi02 | Xlbt_Font.Xpcfi01 => True,  
                               others => False)),  
              Swab_00_01 & Swab_00_02 & Swab_00_03 &  
                 Swab_00_04 & Swab_00_05 & Swab_00_06);  
        Test_Io.New_Line;  
    end Test_X_Char_Struct;

    --  --  --  --  --  --  --  --  --  --  --  --  --  --  --  --  --  --

    procedure Test_X_Char_Struct_Array_2d is  
        procedure To_Raw is new Dummy.Convert_From_2d_Array  
                                   (Xlbt_Font.X_Char_Struct,
--/ if TeleGen2_2d_Bug then
--//                                     Xlbt_Arithmetic.Telegen2_2d_Bug,
--/ else
                                    Xlbt_Arithmetic.U_Char,
--/ end if;
                                    Xlbt_Arithmetic.U_Char,  
                                    Xlbt_Font3.X_Char_Struct_Array_2d,  
                                    Xlbmt_Network_Types.X_Raw_Data_Array);
--
        procedure Test is new Tests.Tester_2d  
                                 (Xlbt_Font.X_Char_Struct,
--/ if TeleGen2_2d_Bug then
--//                                     Xlbt_Arithmetic.Telegen2_2d_Bug,
--/ else
                                  Xlbt_Arithmetic.U_Char,
--/ end if;
                                  Xlbt_Arithmetic.U_Char,  
                                  Xlbt_Font3.X_Char_Struct_Array_2d,  
                                  "X_Char_Struct_Array_2d", To_Raw,  
                                  Xlbip_Base_Converters.From_Raw);  
    begin  
        Test_Io.Section ("X_Char_Struct_Array_2d conversions");  
        Test ("1..0 => (1..0 => 0)",  
              (1 .. 0 => (1 .. 0 => (0, 0, 0, 0, 0, (others => False)))),  
              (1 .. 0 => 0));  
        Test ("1..1 => (2..2 => (1, 2, 3, 4, 5, 6))",  
              (1 => (2 => (1, 2, 3, 4, 5,  
                           (Xlbt_Font.Xpcfi02 | Xlbt_Font.Xpcfi01 => True,  
                            others => False)))),  
              Swab_00_01 & Swab_00_02 & Swab_00_03 &  
                 Swab_00_04 & Swab_00_05 & Swab_00_06);  
        Test ("0..0 => (0..0 => (1, 2, 3, 4, 5, 6))",  
              (0 => (0 => (1, 2, 3, 4, 5,  
                           (Xlbt_Font.Xpcfi02 | Xlbt_Font.Xpcfi01 => True,  
                            others => False)))),  
              Swab_00_01 & Swab_00_02 & Swab_00_03 &  
                 Swab_00_04 & Swab_00_05 & Swab_00_06);  
        Test ("(0, 1, 2), (3, 4, 5)",  
              (((0, 0, 0, 0, 0, Xlbt_Font.None_X_Per_Char_Flags),  
                (1, 0, 0, 0, 0, Xlbt_Font.None_X_Per_Char_Flags),  
                (2, 0, 0, 0, 0, Xlbt_Font.None_X_Per_Char_Flags)),  
               ((3, 0, 0, 0, 0, Xlbt_Font.None_X_Per_Char_Flags),  
                (4, 0, 0, 0, 0, Xlbt_Font.None_X_Per_Char_Flags),  
                (5, 0, 0, 0, 0, Xlbt_Font.None_X_Per_Char_Flags))),  
              ((Swab_00_00 & (1 .. 10 => 0)) & (Swab_00_01 & (1 .. 10 => 0)) &  
               (Swab_00_02 & (1 .. 10 => 0)) & (Swab_00_03 & (1 .. 10 => 0)) &  
               (Swab_00_04 & (1 .. 10 => 0)) & (Swab_00_05 & (1 .. 10 => 0))));  
        Test_Io.New_Line;  
    end Test_X_Char_Struct_Array_2d;

    --  --  --  --  --  --  --  --  --  --  --  --  --  --  --  --  --  --

    procedure Test_X_Colormap_Array is  
        procedure To_Raw is new Dummy.Convert_From_Array  
                                   (Xlbt_Basic.X_Colormap,  
                                    Xlbt_Arithmetic.S_Natural,  
                                    Xlbt_Basic.X_Colormap_Array,  
                                    Xlbmt_Network_Types.X_Raw_Data_Array);  
        procedure Test is new Tests.Tester_1d (Xlbt_Basic.X_Colormap,  
                                               Xlbt_Arithmetic.S_Natural,  
                                               Xlbt_Basic.X_Colormap_Array,  
                                               "X_Colormap_Array", To_Raw,  
                                               Xlbip_Base_Converters.From_Raw);  
    begin  
        Test_Io.Section ("X_Colormap_Array conversions");  
        Test ("1..0 => 0", (1 .. 0 => (Id => (Number => 0))), (1 .. 0 => 0));  
        Test ("1..1 => -1", (1 => (Id => (Number => Minus_1))),  
              (1 .. 4 => Raw_Ff));  
        Test ("0..0 => 2", (0 => (Id => (Number => 2))), Swab_00_00_00_02);  
        Test ("1..2 => 1", (1 .. 2 => (Id => (Number => 1))),  
              Swab_00_00_00_01 & Swab_00_00_00_01);  
        Test_Io.New_Line;  
    end Test_X_Colormap_Array;

    --  --  --  --  --  --  --  --  --  --  --  --  --  --  --  --  --  --

    procedure Test_X_Event_Mask is  
        procedure From_Raw is new Dummy.Convert_To_Private  
                                     (Xlbt_Basic.X_Event_Mask,  
                                      Xlbmt_Network_Types.X_Raw_Data_Array);  
        procedure Test     is new Tests.Tester  
                                     (Xlbt_Basic.X_Event_Mask, "X_Event_Mask",  
                                      Xlbip_Base_Converters.To_Raw, From_Raw);  
    begin  
        Test_Io.Section ("X_Event_Mask conversions");  
        Test ("0", (others => False), (1 .. 4 => 0));  
        Test ("-1", (others => True), (1 .. 4 => Raw_Ff));  
        Test ("1", (Xlbt_Basic.Key_Press_Mask => True, others => False),  
              Swab_00_00_00_01);  
        Test_Io.New_Line;  
    end Test_X_Event_Mask;

    --  --  --  --  --  --  --  --  --  --  --  --  --  --  --  --  --  --

    procedure Test_X_Font_Prop_Array is  
        procedure To_Raw is new Dummy.Convert_From_Array  
                                   (Xlbt_Font3.X_Font_Prop,  
                                    Xlbt_Arithmetic.S_Natural,  
                                    Xlbt_Font3.X_Font_Prop_Array,  
                                    Xlbmt_Network_Types.X_Raw_Data_Array);  
        procedure Test is new Tests.Tester_1d (Xlbt_Font3.X_Font_Prop,  
                                               Xlbt_Arithmetic.S_Natural,  
                                               Xlbt_Font3.X_Font_Prop_Array,  
                                               "X_Font_Prop_Array", To_Raw,  
                                               Xlbip_Base_Converters.From_Raw);  
    begin  
        Test_Io.Section ("X_Font_Prop_Array conversions");  
        Test ("1..0 => 0", (1 .. 0 => ((Number => 0), 0)), (1 .. 0 => 0));  
        Test ("1..1 => -1", (1 => ((Number => Minus_1), Minus_1)),  
              (1 .. 8 => Raw_Ff));  
        Test ("0..0 => 1", (0 => ((Number => 0), 1)),  
              Swab_00_00_00_00 & Swab_00_00_00_01);  
        Test ("(1, 2), (3, 4)", (((Number => 1), 2), ((Number => 3), 4)),  
              (Swab_00_00_00_01 & Swab_00_00_00_02 &  
               Swab_00_00_00_03 & Swab_00_00_00_04));  
        Test_Io.New_Line;  
    end Test_X_Font_Prop_Array;

    --  --  --  --  --  --  --  --  --  --  --  --  --  --  --  --  --  --

    procedure Test_X_Id is  
        procedure From_Raw is  
           new Dummy.Convert_To_Private  
                  (Xlbt_Basic.X_Id, Xlbmt_Network_Types.X_Raw_Data_Array);  
        procedure Test     is new Tests.Tester  
                                     (Xlbt_Basic.X_Id, "X_Id",  
                                      Xlbip_Base_Converters.To_Raw, From_Raw);  
    begin  
        Test_Io.Section ("X_Id conversions");  
        Test ("0", (Number => 0), (1 .. 4 => 0));  
        Test ("-1", (Number => Minus_1), (1 .. 4 => Raw_Ff));  
        Test ("1", (Number => 1), Swab_00_00_00_01);  
        Test_Io.New_Line;  
    end Test_X_Id;

    --  --  --  --  --  --  --  --  --  --  --  --  --  --  --  --  --  --

    procedure Test_X_Key_Code_Array is  
        procedure Test is new Tests.Tester_1d  
                                 (Xlbt_Key.X_Key_Code,  
                                  Xlbt_Arithmetic.S_Natural,  
                                  Xlbt_Key.X_Key_Code_Array, "X_Key_Code_Array",  
                                  Xlbip_Base_Converters.To_Raw,  
                                  Xlbip_Base_Converters.From_Raw);  
    begin  
        Test_Io.Section ("X_Key_Code_Array conversions");  
        Test ("1..0 => 0", (1 .. 0 => 0), (1 .. 0 => 0));  
        Test ("5..5 => -1", (5 => 255), (1 .. 1 => Raw_Ff));  
        Test ("0..0 => 2", (0 => 2), (1 .. 1 => 2));  
        Test ("1, 2", (1, 2), (1, 2));  
        Test_Io.New_Line;  
    end Test_X_Key_Code_Array;

    --  --  --  --  --  --  --  --  --  --  --  --  --  --  --  --  --  --

    procedure Test_X_Key_Sym is  
        procedure Test is new Tests.Tester (Xlbt_Key.X_Key_Sym, "X_Key_Sym",  
                                            Xlbip_Base_Converters.To_Raw,  
                                            Xlbip_Base_Converters.From_Raw);  
    begin  
        Test_Io.Section ("X_Key_Sym conversions");  
        Test ("0", 0, (1 .. 4 => 0));  
        Test ("-1", Minus_1, (1 .. 4 => Raw_Ff));  
        Test ("1", 1, Swab_00_00_00_01);  
        Test_Io.New_Line;  
    end Test_X_Key_Sym;

    --  --  --  --  --  --  --  --  --  --  --  --  --  --  --  --  --  --

    procedure Test_X_Key_Sym_Array_2d is  
        procedure Test is new Tests.Tester_2d  
                                 (Xlbt_Key.X_Key_Sym,
--/ if TeleGen2_2d_Bug then
--//                                     Xlbt_Arithmetic.Telegen2_2d_Bug,
--/ else
                                  Xlbt_Key.X_Key_Code,
--/ end if;
                                  Xlbt_Arithmetic.U_Char,  
                                  Xlbt_Key.X_Key_Sym_Array_2d,  
                                  "X_Key_Sym_Array_2d",  
                                  Xlbip_Base_Converters.To_Raw,  
                                  Xlbip_Base_Converters.From_Raw);  
    begin  
        Test_Io.Section ("X_Key_Sym_Array_2d conversions");  
        Test ("1..0 => (1..0 => 0)", (1 .. 0 => (1 .. 0 => 0)), (1 .. 0 => 0));  
        Test ("1..1 => (2..2 => -1)", (1 => (2 => Minus_1)), Swab_Ff_Ff_Ff_Ff);  
        Test ("0..0 => (0..0 => 1)", (0 => (0 => 1)), Swab_00_00_00_01);  
        Test ("(1,2,3), (4,5,6)", ((1, 2, 3), (4, 5, 6)),  
              Swab_00_00_00_01 & Swab_00_00_00_02 & Swab_00_00_00_03 &  
                 Swab_00_00_00_04 & Swab_00_00_00_05 & Swab_00_00_00_06);  
        Test_Io.New_Line;  
    end Test_X_Key_Sym_Array_2d;

    --  --  --  --  --  --  --  --  --  --  --  --  --  --  --  --  --  --

    procedure Test_X_Led_Bits is  
        procedure From_Raw is new Dummy.Convert_To_Private  
                                     (Xlbt_Keyboard.X_Led_Bits,  
                                      Xlbmt_Network_Types.X_Raw_Data_Array);  
        procedure Test     is new Tests.Tester  
                                     (Xlbt_Keyboard.X_Led_Bits, "X_Led_Bits",  
                                      Xlbip_Base_Converters.To_Raw, From_Raw);  
    begin  
        Test_Io.Section ("X_Led_Bits conversions");  
        Test ("0", (others => False), (1 .. 4 => 0));  
        Test ("-1", (others => True), (1 .. 4 => Raw_Ff));  
        Test ("1", (Xlbt_Keyboard.Led00 => True, others => False),  
              Swab_00_00_00_01);  
        Test_Io.New_Line;  
    end Test_X_Led_Bits;

    --  --  --  --  --  --  --  --  --  --  --  --  --  --  --  --  --  --

    procedure Test_X_Modifier_Key_Code_Array is  
        procedure Test is new Tests.Tester_1d  
                                 (Xlbt_Key3.X_Modifier_Key_Code_Sub_Array,  
                                  Xlbt_Arithmetic.S_Natural,  
                                  Xlbt_Key3.X_Modifier_Key_Code_Array,  
                                  "X_Modifier_Key_Code_Array",  
                                  Xlbip_Base_Converters.To_Raw,  
                                  Xlbip_Base_Converters.From_Raw);  
    begin  
        Test_Io.Section ("X_Modifier_Key_Code_Array conversions");  
        Test ("1..0 => 0", (1 .. 0 => (others => 0)), (1 .. 0 => 0));  
        Test ("2..2 => (1,2,3,4,5,6,7,8)",  
              (2 => (1, 2, 3, 4, 5, 6, 7, 8)), (1, 2, 3, 4, 5, 6, 7, 8));  
        Test ("0..0 => (8,7,6,5,4,3,2,1)",  
              (0 => (8, 7, 6, 5, 4, 3, 2, 1)), (8, 7, 6, 5, 4, 3, 2, 1));  
        Test ("(1), (2)", ((Xlbt_Key.Mod_5_Map_Index => 1, others => 0),  
                           (Xlbt_Key.Mod_5_Map_Index => 2, others => 0)),  
              (0, 0, 0, 0, 0, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0, 2));  
        Test_Io.New_Line;  
    end Test_X_Modifier_Key_Code_Array;

    --  --  --  --  --  --  --  --  --  --  --  --  --  --  --  --  --  --

    procedure Test_X_Pixel_Array is  
        procedure Test is new Tests.Tester_1d  
                                 (Xlbt_Basic.X_Pixel, Xlbt_Arithmetic.S_Natural,  
                                  Xlbt_Basic.X_Pixel_Array, "X_Pixel_Array",  
                                  Xlbip_Base_Converters.To_Raw,  
                                  Xlbip_Base_Converters.From_Raw);  
    begin  
        Test_Io.Section ("X_Pixel_Array conversions");  
        Test ("1..0 => 0", (1 .. 0 => 0), (1 .. 0 => 0));  
        Test ("2..2 => -1", (2 => Minus_1), (1 .. 4 => Raw_Ff));  
        Test ("0..0 => 2", (0 => 2), Swab_00_00_00_02);  
        Test ("1, 2", (1, 2), Swab_00_00_00_01 & Swab_00_00_00_02);  
        Test_Io.New_Line;  
    end Test_X_Pixel_Array;

    --  --  --  --  --  --  --  --  --  --  --  --  --  --  --  --  --  --

    procedure Test_X_Plane_Mask is  
        procedure From_Raw is new Dummy.Convert_To_Discrete  
                                     (Xlbt_Basic.X_Plane_Mask,  
                                      Xlbmt_Network_Types.X_Raw_Data_Array);  
        procedure Test     is new Tests.Tester  
                                     (Xlbt_Basic.X_Plane_Mask, "X_Plane_Mask",  
                                      Xlbip_Base_Converters.To_Raw, From_Raw);  
    begin  
        Test_Io.Section ("X_Plane_Mask conversions");  
        Test ("0", 0, (1 .. 4 => 0));  
        Test ("-1", Minus_1, (1 .. 4 => Raw_Ff));  
        Test ("1", 1, Swab_00_00_00_01);  
        Test_Io.New_Line;  
    end Test_X_Plane_Mask;

    --  --  --  --  --  --  --  --  --  --  --  --  --  --  --  --  --  --

    procedure Test_X_Plane_Mask_Array is  
        procedure To_Raw is new Dummy.Convert_From_Array  
                                   (Xlbt_Basic.X_Plane_Mask,  
                                    Xlbt_Arithmetic.S_Natural,  
                                    Xlbt_Basic.X_Plane_Mask_Array,  
                                    Xlbmt_Network_Types.X_Raw_Data_Array);  
        procedure Test is new Tests.Tester_1d (Xlbt_Basic.X_Plane_Mask,  
                                               Xlbt_Arithmetic.S_Natural,  
                                               Xlbt_Basic.X_Plane_Mask_Array,  
                                               "X_Plane_Mask_Array", To_Raw,  
                                               Xlbip_Base_Converters.From_Raw);  
    begin  
        Test_Io.Section ("X_Plane_Mask_Array conversions");  
        Test ("1..0 => 0", (1 .. 0 => 0), (1 .. 0 => 0));  
        Test ("2..2 => -1", (2 => Minus_1), (1 .. 4 => Raw_Ff));  
        Test ("0..0 => 2", (0 => 2), Swab_00_00_00_02);  
        Test ("1, 2", (1, 2), Swab_00_00_00_01 & Swab_00_00_00_02);  
        Test_Io.New_Line;  
    end Test_X_Plane_Mask_Array;

    --  --  --  --  --  --  --  --  --  --  --  --  --  --  --  --  --  --

    -- procedure Test_String is
    --     procedure Test is new Tests.Tester_1d (Character, Positive, String,
    --                                            "String", To_Raw, From_Raw);
    -- begin
    --     Test_Io.Section ("String conversions");
    --     Test ("1..0 => 0", (1 .. 0 => Ascii.Nul), (1 .. 0 => 0));
    --     Test ("2..2 => 127", (2 => Ascii.Del), (1 => 127));
    --     Test ("0..0 => 1", (0 => Ascii.Soh), (1 => 1));
    --     Test ("Abc", "Abc", (65, 98, 99));
    --
    --     -- Verify that high bits are chopped in raw data.
    --     declare
    --         Result : String (1 .. 4);
    --     begin
    --         Test_Io.Put ("Chopping raw datum ");
    --
    --         From_Raw (Result, (Raw_80, 16#7F#, Raw_Ab, Raw_Ff));
    --         if (Result = Ascii.Nul & Ascii.Del & '+' & Ascii.Del) then
    --             Test_Io.Put_Line (". done.");
    --         else
    --             Test_Io.Put_Line ("<failed> done.");
    --             Test_Io.Put_Error ("Converter tests for String failed.");
    --         end if;
    --     exception
    --         when others =>
    --             Test_Io.Put_Line ("<exception raised> aborted.");
    --             Test_Io.Put_Exception ("Converter tests for String" &
    --                                    " raised an unexpected exception.");
    --     end;
    --
    --     -- Verify that translation works.
    --     declare
    --         Trans  : X_Raw_Character_Array := (others => '?');
    --         Result : String (1 .. 4);
    --     begin
    --         Test_Io.Put ("Translating raw datum ");
    --
    --         Trans (Raw_80) := 'w';
    --         Trans (16#7F#) := 'x';
    --         Trans (Raw_Ab) := 'y';
    --         Trans (Raw_Ff) := 'z';
    --         From_Raw (Result, (Raw_80, 16#7F#, Raw_Ab, Raw_Ff), Trans);
    --         if (Result = "wxyz") then
    --             Test_Io.Put_Line (". done.");
    --         else
    --             Test_Io.Put_Line ("<failed> done.");
    --             Test_Io.Put_Error ("Converter tests for String failed.");
    --         end if;
    --     exception
    --         when others =>
    --             Test_Io.Put_Line ("<exception raised> aborted.");
    --             Test_Io.Put_Exception ("Converter tests for String" &
    --                                    " raised an unexpected exception.");
    --     end;
    --     Test_Io.New_Line;
    -- end Test_String;

    --  --  --  --  --  --  --  --  --  --  --  --  --  --  --  --  --  --

    procedure Test_X_String is  
        procedure Test is new Tests.Tester_1d (Xlbt_String.X_Character,  
                                               Xlbt_Arithmetic.S_Natural,  
                                               Xlbt_String.X_String, "X_String",  
                                               Xlbip_Base_Converters.To_Raw,  
                                               Xlbip_Base_Converters.From_Raw);  
        use Xlbt_String;  
    begin  
        Test_Io.Section ("X_String conversions");  
        Test ("1..0 => 0", (1 .. 0 => Nul), (1 .. 0 => 0));  
        Test ("2..2 => 255", (2 => C255), (1 => Raw_Ff));  
        Test ("0..0 => 1", (0 => Soh), (1 => 1));  
        Test ("Abc", "Abc", (65, 98, 99));  
        Test_Io.New_Line;  
    end Test_X_String;

    --  --  --  --  --  --  --  --  --  --  --  --  --  --  --  --  --  --

    procedure Test_X_String16 is  
        procedure Test is new Tests.Tester_1d  
                                 (Xlbt_String16.X_Character16,  
                                  Xlbt_Arithmetic.S_Natural,  
                                  Xlbt_String16.X_String16, "X_String16",  
                                  Xlbip_Base_Converters.To_Raw,  
                                  Xlbip_Base_Converters.From_Raw);
        -- The protocol says a STRING16 is a list of CHAR2B's, and
        -- stipulates that CHAR2Bs are NOT byte-swapped.  They are
        -- always sent Most-Significant-Byte first.
    begin  
        Test_Io.Section ("X_String16 conversions");  
        Test ("1..0 => 0", (1 .. 0 => (0, 0)), (1 .. 0 => 0));  
        Test ("2..2 => -1", (2 => (255, 255)), (Raw_Ff, Raw_Ff));  
        Test ("0..0 => 1", (0 => (0, 1)), (0, 1));  
        Test ("1.2, 3.4, 5.6", ((1, 2), (3, 4), (5, 6)), (1, 2, 3, 4, 5, 6));  
        Test_Io.New_Line;  
    end Test_X_String16;

    --  --  --  --  --  --  --  --  --  --  --  --  --  --  --  --  --  --

    procedure Test_X_Text_Elt is  
        procedure From_Raw is new Dummy.Convert_To_Private  
                                     (Xlbt_Misc.X_Text_Elt,  
                                      Xlbmt_Network_Types.X_Raw_Data_Array);  
        procedure Test     is new Tests.Tester  
                                     (Xlbt_Misc.X_Text_Elt, "X_Text_Elt",  
                                      Xlbip_Base_Converters.To_Raw, From_Raw);  
    begin  
        Test_Io.Section ("X_Text_Elt conversions");  
        Test ("0", (0, 0), (0, 0));  
        Test ("1", (1, 0), Swab_01_00);  
        Test ("-1", (255, Minus_1), Swab_Ff_Ff);  
        Test_Io.New_Line;  
    end Test_X_Text_Elt;

    --  --  --  --  --  --  --  --  --  --  --  --  --  --  --  --  --  --

    procedure Test_X_Time_Coord_Array is  
        procedure To_Raw is new Dummy.Convert_From_Array  
                                   (Xlbt_Pointer.X_Time_Coord,  
                                    Xlbt_Arithmetic.S_Natural,  
                                    Xlbt_Pointer.X_Time_Coord_Array,  
                                    Xlbmt_Network_Types.X_Raw_Data_Array);  
        procedure Test is new Tests.Tester_1d (Xlbt_Pointer.X_Time_Coord,  
                                               Xlbt_Arithmetic.S_Natural,  
                                               Xlbt_Pointer.X_Time_Coord_Array,  
                                               "X_Time_Coord_Array", To_Raw,  
                                               Xlbip_Base_Converters.From_Raw);  
    begin  
        Test_Io.Section ("X_Time_Coord_Array conversions");  
        Test ("1..0 => 0", (1 .. 0 => (0, 0, 0)), (1 .. 0 => 0));  
        Test ("2..2 => -1",  
              (2 => (Minus_1, 16#FFFF#, 16#FFFF#)), (1 .. 8 => Raw_Ff));  
        Test ("0..0 => 1", (0 => (0, 0, 1)), (1 .. 6 => 0) & Swab_00_01);  
        Test ("1.2.3, 4.5.6", ((1, 2, 3), (4, 5, 6)),  
              Swab_00_00_00_01 & Swab_00_02 & Swab_00_03 &  
                 Swab_00_00_00_04 & Swab_00_05 & Swab_00_06);  
        Test_Io.New_Line;  
    end Test_X_Time_Coord_Array;

    --  --  --  --  --  --  --  --  --  --  --  --  --  --  --  --  --  --

    procedure Test_X_Window_Array is  
        procedure To_Raw is new Dummy.Convert_From_Array  
                                   (Xlbt_Basic.X_Window,  
                                    Xlbt_Arithmetic.S_Natural,  
                                    Xlbt_Basic.X_Window_Array,  
                                    Xlbmt_Network_Types.X_Raw_Data_Array);  
        procedure Test is new Tests.Tester_1d (Xlbt_Basic.X_Window,  
                                               Xlbt_Arithmetic.S_Natural,  
                                               Xlbt_Basic.X_Window_Array,  
                                               "X_Window_Array", To_Raw,  
                                               Xlbip_Base_Converters.From_Raw);  
    begin  
        Test_Io.Section ("X_Window_Array conversions");  
        Test ("1..0 => 0", (1 .. 0 => (Drawable => (Id => (Number => 0)))),  
              (1 .. 0 => 0));  
        Test ("2..2 => -1", (2 => (Drawable => (Id => (Number => Minus_1)))),  
              (1 .. 4 => Raw_Ff));  
        Test ("0..0 => 1", (0 => (Drawable => (Id => (Number => 1)))),  
              Swab_00_00_00_01);  
        Test ("1, 2", ((Drawable => (Id => (Number => 1))),  
                       (Drawable => (Id => (Number => 2)))),  
              Swab_00_00_00_01 & Swab_00_00_00_02);  
        Test_Io.New_Line;  
    end Test_X_Window_Array;

    --  --  --  --  --  --  --  --  --  --  --  --  --  --  --  --  --  --

    procedure Test_S_Long is  
        procedure From_Raw is new Dummy.Convert_To_Discrete  
                                     (Xlbt_Arithmetic.S_Long,  
                                      Xlbmt_Network_Types.X_Raw_Data_Array);  
        procedure Test     is new Tests.Tester  
                                     (Xlbt_Arithmetic.S_Long, "S_Long",  
                                      Xlbip_Base_Converters.To_Raw, From_Raw);  
    begin  
        Test_Io.Section ("S_Long conversions");  
        Test ("0", 0, (1 .. 4 => 0));  
        Test ("1", 1, Swab_00_00_00_01);  
        Test ("-1", Minus_1, (1 .. 4 => Raw_Ff));  
        Test_Io.New_Line;  
    end Test_S_Long;

    --  --  --  --  --  --  --  --  --  --  --  --  --  --  --  --  --  --

    procedure Test_U_Char_Array is  
        procedure Test is new Tests.Tester_1d  
                                 (Xlbt_Arithmetic.U_Char,  
                                  Xlbt_Arithmetic.S_Natural,  
                                  Xlbt_Arithmetic.U_Char_Array, "U_Char_Array",  
                                  Xlbip_Base_Converters.To_Raw,  
                                  Xlbip_Base_Converters.From_Raw);  
    begin  
        Test_Io.Section ("U_Char_Array conversions");  
        Test ("1..0 => 0", (1 .. 0 => 0), (1 .. 0 => 0));  
        Test ("2..2 => -1", (2 => 255), (1 => Raw_Ff));  
        Test ("0..0 => 1", (0 => 1), (1 => 1));  
        Test ("1, 2, 3", (1, 2, 3), (1, 2, 3));  
        Test_Io.New_Line;  
    end Test_U_Char_Array;

begin  
    Test_X_Atom_Array;  
    Test_X_Char_Struct;  
    Test_X_Char_Struct_Array_2d;  
    Test_X_Colormap_Array;  
    Test_X_Event_Mask;  
    Test_X_Font_Prop_Array;  
    Test_X_Id;  
    Test_X_Key_Code_Array;  
    Test_X_Key_Sym;  
    Test_X_Key_Sym_Array_2d;  
    Test_X_Led_Bits;  
    Test_X_Modifier_Key_Code_Array;  
    Test_X_Pixel_Array;  
    Test_X_Plane_Mask;  
    Test_X_Plane_Mask_Array;
    -- Test_String;
    Test_X_String;  
    Test_X_String16;  
    Test_X_Text_Elt;  
    Test_X_Time_Coord_Array;  
    Test_X_Window_Array;  
    Test_S_Long;  
    Test_U_Char_Array;  
end Cvt_020;