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 - metrics - download
Index: B T

⟦8f0cb1b53⟧ TextFile

    Length: 2525 (0x9dd)
    Types: TextFile
    Names: »B«

Derivation

└─⟦180fe333a⟧ Bits:30000405 8mm tape, Rational 1000, SW CATALOG, 10_20_0
└─⟦180fe333a⟧ Bits:30000537 8mm tape, Rational 1000, SW Catalog 10_20_0
    └─⟦5cb1d1d7f⟧ »DATA« 
        └─⟦3b1ee7bd8⟧ 
            └─⟦this⟧ 

TextFile

-- HEAPSORT PERFORMANCE BENCHMARK.

with Instrument;
use Instrument;
with Hpsort;
use Hpsort;

procedure Hsdra2 is


    -- TITLE:       HEAP SORT PERFORMANCE TEST DRIVER

    -- PURPOSE:     THIS IS THE ADA VERSION OF THE HEAP SORT ALGORITHM

    --              THIS ALGORITHM IS BEING WRITTEN IN ADA, PASCAL AND

    --              ASSEMBLER AND THEN COMPARED WITH RESPECT TO EXECUTION

    --              TIME AND STORAGE USAGE.

    -- DESCRIPTION: THIS DRIVER RUNS TWENTY TESTS OF THE HEAP SORT ROUTINE.

    --              THE FIRST FOUR TEST BOUNDARY CONDITIONS IN THE HEAP

    --              SORT ALGORITHM.  THE LAST SIXTEEN SORT EVENLY DISTIRBUTE

    --              PSEUDO-RANDOM NUMBERS; THE MEAN OF THESE SIXTEEN TESTS

    --              SHOULD BE USED FOR COMPARISON TO OTHER VERSIONS.

    Heapsize : Pos_Int := Pos_Int'Last;

    Randomno : Small_Int := 1;

    Failed : Boolean := False;

    Heap : Heap_Array;



    procedure Test (Tstnum : in Pos_Int;

                    Heap : in out Heap_Array;

                    Heapsize : in Pos_Int) is

    begin

        Heapsort (Heap, Heapsize);

        for Heapindx in 2 .. Heapsize loop

            if Heap (Heapindx) < Heap (Heapindx - 1) then

                Failed := True;

                return;

            end if;

        end loop; --FOR

    end Test;





begin

    Start ("HSDRA2", "HEAPSORT PERFORMANCE BENCHMARK.");

    for Heapindx in 1 .. Heapsize loop

        Heap (Heapindx) := Small_Int (Heapindx);

    end loop; -- FOR

    Test (1, Heap, Heapsize);



    for Heapindx in 1 .. Heapsize loop

        Heap (Heapindx) := -Small_Int (Heapindx);

    end loop;  --FOR

    Test (2, Heap, Heapsize);



    for Heapindx in 1 .. Heapsize loop

        Heap (Heapindx) := 234;

    end loop;  --FOR

    Test (3, Heap, Heapsize);



    for Heapindx in 1 .. Heapsize / 2 loop

        Heap (Heapindx) := Small_Int (Heapindx);

        Heap (Heapsize - Heapindx + 1) := Small_Int (Heapindx);

    end loop;  --FOR

    Test (4, Heap, Heapsize);



    for Tstindx in 5 .. 20 loop

        for Heapindx in 1 .. Heapsize loop

            Randomno := Randomno * 16;

            while Randomno > 383 loop

                Randomno := Randomno - 383;

            end loop; --WHILE

            Heap (Heapindx) := Randomno + Heap (Heapindx);

        end loop; --FOR

        Test (Tstindx, Heap, Heapsize);

    end loop; --FOR



    if Failed then

        Comment ("FAILED IN HEAPSORT");

    end if;

    Stop;

end Hsdra2;