DataMuseum.dk

Presents historical artifacts from the history of:

Rational R1000/400

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

Excavated with: AutoArchaeologist - Free & Open Source Software.


top - download

⟦d0b8b5ca6⟧ Ada Source

    Length: 14336 (0x3800)
    Types: Ada Source
    Notes: 03_class, FILE, R1k_Segment, e3_tag, procedure Cvt_050, seg_005493

Derivation

└─⟦8527c1e9b⟧ Bits:30000544 8mm tape, Rational 1000, Arrival backup of disks in PAM's R1000
    └─ ⟦5a81ac88f⟧ »Space Info Vol 1« 
        └─⟦this⟧ 

E3 Source Code



with Test_Io;  
with Cvt_Test_Utilities;

with Xlbt_Arithmetic;  
with Xlbt_Basic;  
with Xlbt_Graphics;  
with Xlbmt_Network_Types;

with Xlbip_Graphic_Converters;


procedure Cvt_050 is
------------------------------------------------------------------------------
-- Tests for Xlbip_Graphic_Converters
--
-- Xlbip_Graphic_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.
------------------------------------------------------------------------------
-- ****************************************************************************
-- * Date      - /Name/ Comment
-- *
-- * 12-OCT-90 - /DRK/ Created.
-- *  8-NOV-90 - /DRK/ Track updates to Xlbip_Graphic_Converters.
-- ****************************************************************************
------------------------------------------------------------------------------


    ---------------------------------
    -- 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_Pixel is  
        procedure From_Raw is  
           new Dummy.Convert_To_Discrete  
                  (Xlbt_Basic.X_Pixel, Xlbmt_Network_Types.X_Raw_Data_Array);  
        procedure Test is new Tests.Tester  
                                 (Xlbt_Basic.X_Pixel, "X_Pixel",  
                                  Xlbip_Graphic_Converters.To_Raw, From_Raw);  
    begin  
        Test_Io.Section ("X_Pixel conversions");  
        Test ("0", 0, (1 .. 4 => 16#00#));  
        Test ("1", 1, Swab_00_00_00_01);  
        Test ("-1", Minus_1, (1 .. 4 => Raw_Ff));  
        Test ("16#8000_0000#", Xlbt_Basic.X_Pixel'First, Swab_80_00_00_00);  
        Test ("16#7FFF_FFFF#", Xlbt_Basic.X_Pixel'Last, Swab_7f_Ff_Ff_Ff);  
        Test ("16#0123_4567#", 16#0123_4567#, Swab_01_23_45_67);  
        Test_Io.New_Line;  
    end Test_X_Pixel;

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

    procedure Test_X_Arc is  
        procedure From_Raw is  
           new Dummy.Convert_To_Private  
                  (Xlbt_Graphics.X_Arc, Xlbmt_Network_Types.X_Raw_Data_Array);  
        procedure Test is new Tests.Tester  
                                 (Xlbt_Graphics.X_Arc, "X_Arc",  
                                  Xlbip_Graphic_Converters.To_Raw, From_Raw);  
    begin  
        Test_Io.Section ("X_Arc conversions");  
        Test ("0", (0, 0, 0, 0, 0, 0), (1 .. 12 => 0));  
        Test ("-1", (Minus_1, Minus_1, 16#FFFF#, 16#FFFF#, Minus_1, Minus_1),  
              (1 .. 12 => Raw_Ff));  
        Test ("1.2.3.4.5.6", (1, 2, 3, 4, 5, 6),  
              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_Arc;

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

    procedure Test_X_Arc_Array is  
        procedure From_Raw is  
           new Dummy.Convert_To_Array  
                  (Xlbt_Graphics.X_Arc, Xlbt_Arithmetic.S_Natural,  
                   Xlbt_Graphics.X_Arc_Array,  
                   Xlbmt_Network_Types.X_Raw_Data_Array);  
        procedure Test is new Tests.Tester_1d  
                                 (Xlbt_Graphics.X_Arc,  
                                  Xlbt_Arithmetic.S_Natural,  
                                  Xlbt_Graphics.X_Arc_Array, "X_Arc_Array",  
                                  Xlbip_Graphic_Converters.To_Raw, From_Raw);  
    begin  
        Test_Io.Section ("X_Arc_Array conversions");  
        Test ("1..0 => 0", (1 .. 0 => (0, 0, 0, 0, 0, 0)), (1 .. 0 => 0));  
        Test ("2..2 => -1", (2 => (Minus_1, Minus_1, 16#FFFF#,  
                                   16#FFFF#, Minus_1, Minus_1)),  
              (1 .. 12 => Raw_Ff));  
        Test ("0..0 => 1", (0 => (0, 0, 0, 0, 0, 1)),  
              (1 .. 10 => 0) & Swab_00_01);  
        Test ("1.2.3.4.5.6, 7.8.9.10.11.12",  
              ((1, 2, 3, 4, 5, 6), (7, 8, 9, 10, 11, 12)),  
              Swab_00_01 & Swab_00_02 & Swab_00_03 & Swab_00_04 &  
                 Swab_00_05 & Swab_00_06 & Swab_00_07 & Swab_00_08 &  
                 Swab_00_09 & Swab_00_0a & Swab_00_0b & Swab_00_0c);  
        Test_Io.New_Line;  
    end Test_X_Arc_Array;

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

    procedure Test_X_Point is  
        procedure From_Raw is new Dummy.Convert_To_Private  
                                     (Xlbt_Graphics.X_Point,  
                                      Xlbmt_Network_Types.X_Raw_Data_Array);  
        procedure Test is new Tests.Tester  
                                 (Xlbt_Graphics.X_Point, "X_Point",  
                                  Xlbip_Graphic_Converters.To_Raw, From_Raw);  
    begin  
        Test_Io.Section ("X_Point conversions");  
        Test ("0", (0, 0), (1 .. 4 => 0));  
        Test ("-1", (Minus_1, Minus_1), (1 .. 4 => Raw_Ff));  
        Test ("1.2", (1, 2), Swab_00_01 & Swab_00_02);  
        Test_Io.New_Line;  
    end Test_X_Point;

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

    procedure Test_X_Point_Array is  
        procedure From_Raw is new Dummy.Convert_To_Array  
                                     (Xlbt_Graphics.X_Point,  
                                      Xlbt_Arithmetic.S_Natural,  
                                      Xlbt_Graphics.X_Point_Array,  
                                      Xlbmt_Network_Types.X_Raw_Data_Array);  
        procedure Test is new Tests.Tester_1d  
                                 (Xlbt_Graphics.X_Point,  
                                  Xlbt_Arithmetic.S_Natural,  
                                  Xlbt_Graphics.X_Point_Array, "X_Point_Array",  
                                  Xlbip_Graphic_Converters.To_Raw, From_Raw);  
    begin  
        Test_Io.Section ("X_Point_Array conversions");  
        Test ("1..0 => 0", (1 .. 0 => (0, 0)), (1 .. 0 => 0));  
        Test ("2..2 => -1", (2 => (Minus_1, Minus_1)), (1 .. 4 => Raw_Ff));  
        Test ("0..0 => 1", (0 => (0, 1)), Swab_00_00 & Swab_00_01);  
        Test ("1.2, 3.4, 5.6", ((1, 2), (3, 4), (5, 6)),  
              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_Point_Array;

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

    -- procedure Test_X_Rectangle is
    --     procedure From_Raw is new Dummy.Convert_To_Private
    --                                  (Xlbt_Graphics.X_Rectangle,
    --                                   Xlbmt_Network_Types.X_Raw_Data_Array);
    --     procedure Test is new Tests.Tester
    --                              (Xlbt_Graphics.X_Rectangle, "X_Rectangle",
    --                               Xlbip_Graphic_Converters.To_Raw, From_Raw);
    -- begin
    --     Test_Io.Section ("X_Rectangle conversions");
    --     Test ("0", (0, 0, 0, 0), (1 .. 8 => 0));
    --     Test ("-1", (Minus_1, Minus_1, 16#FFFF#, 16#FFFF#), (1 .. 8 => Raw_Ff));
    --     Test ("1.2.3.4", (1, 2, 3, 4),
    --           Swab_00_01 & Swab_00_02 & Swab_00_03 & Swab_00_04);
    --     Test_Io.New_Line;
    -- end Test_X_Rectangle;

    --  --  --  --  --  --  --  --  --  --  --  --  --  --  --  --  --  --
   procedure Test_X_Rectangle_Array is  
        procedure From_Raw is new Dummy.Convert_To_Array  
                                     (Xlbt_Graphics.X_Rectangle,  
                                      Xlbt_Arithmetic.S_Natural,  
                                      Xlbt_Graphics.X_Rectangle_Array,  
                                      Xlbmt_Network_Types.X_Raw_Data_Array);  
        procedure Test is new Tests.Tester_1d  
                                 (Xlbt_Graphics.X_Rectangle,  
                                  Xlbt_Arithmetic.S_Natural,  
                                  Xlbt_Graphics.X_Rectangle_Array,  
                                  "X_Rectangle_Array",  
                                  Xlbip_Graphic_Converters.To_Raw, From_Raw);  
    begin  
        Test_Io.Section ("X_Rectangle_Array conversions");  
        Test ("1..0 => 0", (1 .. 0 => (0, 0, 0, 0)), (1 .. 0 => 0));  
        Test ("2..2 => -1", (2 => (Minus_1, Minus_1, 16#FFFF#, 16#FFFF#)),  
              (1 .. 8 => Raw_Ff));  
        Test ("0..0 => 1", (0 => (0, 0, 0, 1)), (1 .. 6 => 0) & Swab_00_01);  
        Test ("1.2.3.4, 5.6.7.8", ((1, 2, 3, 4), (5, 6, 7, 8)),  
              Swab_00_01 & Swab_00_02 & Swab_00_03 & Swab_00_04 &  
                 Swab_00_05 & Swab_00_06 & Swab_00_07 & Swab_00_08);  
        Test_Io.New_Line;  
    end Test_X_Rectangle_Array;

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

    -- procedure Test_X_Segment is
    --     procedure From_Raw is new Dummy.Convert_To_Private
    --                                  (Xlbt_Graphics.X_Segment,
    --                                   Xlbmt_Network_Types.X_Raw_Data_Array);
    --     procedure Test is new Tests.Tester
    --                              (Xlbt_Graphics.X_Segment, "X_Segment",
    --                               Xlbip_Graphic_Converters.To_Raw, From_Raw);
    -- begin
    --     Test_Io.Section ("X_Segment conversions");
    --     Test ("0", (0, 0, 0, 0), (1 .. 8 => 0));
    --     Test ("-1", (Minus_1, Minus_1, Minus_1, Minus_1), (1 .. 8 => Raw_Ff));
    --     Test ("1.2.3.4", (1, 2, 3, 4),
    --           Swab_00_01 & Swab_00_02 & Swab_00_03 & Swab_00_04);
    --     Test_Io.New_Line;
    -- end Test_X_Segment;

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

    procedure Test_X_Segment_Array is  
        procedure From_Raw is new Dummy.Convert_To_Array  
                                     (Xlbt_Graphics.X_Segment,  
                                      Xlbt_Arithmetic.S_Natural,  
                                      Xlbt_Graphics.X_Segment_Array,  
                                      Xlbmt_Network_Types.X_Raw_Data_Array);  
        procedure Test is new Tests.Tester_1d  
                                 (Xlbt_Graphics.X_Segment,  
                                  Xlbt_Arithmetic.S_Natural,  
                                  Xlbt_Graphics.X_Segment_Array,  
                                  "X_Segment_Array",  
                                  Xlbip_Graphic_Converters.To_Raw, From_Raw);  
    begin  
        Test_Io.Section ("X_Segment_Array conversions");  
        Test ("1..0 => 0", (1 .. 0 => (0, 0, 0, 0)), (1 .. 0 => 0));  
        Test ("2..2 => -1", (2 => (Minus_1, Minus_1, Minus_1, Minus_1)),  
              (1 .. 8 => Raw_Ff));  
        Test ("0..0 => 1", (0 => (0, 0, 0, 1)), (1 .. 6 => 0) & Swab_00_01);  
        Test ("1.2.3.4, 5.6.7.8", ((1, 2, 3, 4), (5, 6, 7, 8)),  
              Swab_00_01 & Swab_00_02 & Swab_00_03 & Swab_00_04 &  
                 Swab_00_05 & Swab_00_06 & Swab_00_07 & Swab_00_08);  
        Test_Io.New_Line;  
    end Test_X_Segment_Array;

begin  
    Test_X_Pixel;  
    Test_X_Arc;  
    Test_X_Arc_Array;  
    Test_X_Point;  
    Test_X_Point_Array;
    -- Test_X_Rectangle;
    Test_X_Rectangle_Array;
    -- Test_X_Segment;
    Test_X_Segment_Array;  
end Cvt_050;  

E3 Meta Data

    nblk1=d
    nid=0
    hdr6=1a
        [0x00] rec0=1c rec1=00 rec2=01 rec3=01c
        [0x01] rec0=1a rec1=00 rec2=02 rec3=050
        [0x02] rec0=15 rec1=00 rec2=03 rec3=04c
        [0x03] rec0=15 rec1=00 rec2=04 rec3=022
        [0x04] rec0=14 rec1=00 rec2=05 rec3=022
        [0x05] rec0=14 rec1=00 rec2=06 rec3=01c
        [0x06] rec0=12 rec1=00 rec2=07 rec3=008
        [0x07] rec0=14 rec1=00 rec2=08 rec3=002
        [0x08] rec0=0f rec1=00 rec2=09 rec3=098
        [0x09] rec0=14 rec1=00 rec2=0a rec3=012
        [0x0a] rec0=12 rec1=00 rec2=0b rec3=076
        [0x0b] rec0=19 rec1=00 rec2=0c rec3=012
        [0x0c] rec0=01 rec1=00 rec2=0d rec3=000
    tail 0x21500a14681978a1bd90a 0x42a00088462063203