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

⟦9be3242a8⟧ Ada Source

    Length: 7168 (0x1c00)
    Types: Ada Source
    Notes: 03_class, FILE, R1k_Segment, e3_tag, procedure Test_More_String_Utilities, seg_004696

Derivation

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

E3 Source Code



with More_String_Utilities;
use More_String_Utilities;
with Io;
procedure Test_More_String_Utilities is
    Tab : constant Character := Ascii.Ht;

    procedure Report (Result : String; Test : String; Function_Name : String) is
    begin
        if not (Result = Test) then
            Io.Put_Line (Result & " does not equal " & Test &
                         " for function " & Function_Name);
        end if;
    end Report;

    procedure Report
                 (Result : Boolean; Test : Boolean; Function_Name : String) is
    begin
        if not (Result = Test) then
            Io.Put_Line ("Wrong Result (" & Boolean'Image (Result) &
                         ") for function " & Function_Name);
        end if;
    end Report;
begin
    Report (Begins_With ("abc", "abcdef"), True, "Begins_With1");
    Report (Begins_With ("abc", "abc"), True, "Begins_With2");
    Report (Begins_With ("a", "abcdef"), True, "Begins_With3");
    Report (Begins_With ("", "abcdef"), False, "Begins_With4");
    Report (Begins_With ("a", ""), False, "Begins_With5");
    Report (Begins_With ("a", "bcaaa"), False, "Begins_With6");
    Report (Begins_With ("abaa", "abadaa"), False, "Begins_With7");

    Report (Ends_With ("abc", "defabc"), True, "Ends_With1");
    Report (Ends_With ("abc", "abc"), True, "Ends_With2");
    Report (Ends_With ("a", "abcdefa"), True, "Ends_With3");
    Report (Ends_With ("", "abcdef"), False, "Ends_With4");
    Report (Ends_With ("a", ""), False, "Ends_With5");
    Report (Ends_With ("a", "bcaab"), False, "Ends_With6");
    Report (Ends_With ("abaa", "abdbaa"), False, "Ends_With7");

    Report (Contains ("abc", "defabc"), True, "Contains1");
    Report (Contains ("abc", "abc"), True, "Contains2");
    Report (Contains ("a", "abcdefa"), True, "Contains3");
    Report (Contains ("", "abcdef"), True, "Contains4");
    Report (Contains ("a", ""), False, "Contains5");
    Report (Contains ("a", "bcbbb"), False, "Contains6");
    Report (Contains ("abaa", "abdbaa"), False, "Contains7");

    Report (Is_Blank (""), True, "Is_Blank1");
    Report (Is_Blank (" "), True, "Is_Blank2");
    Report (Is_Blank ("   "), True, "Is_Blank3");
    Report (Is_Blank ("   " & Tab), True, "Is_Blank4");
    Report (Is_Blank (Tab & "   "), True, "Is_Blank5");
    Report (Is_Blank (Tab & Tab & Tab), True, "Is_Blank6");
    Report (Is_Blank ("   a   "), False, "Is_Blank7");
    Report (Is_Blank ("   a"), False, "Is_Blank8");
    Report (Is_Blank ("a "), False, "Is_Blank9");
    Report (Is_Blank ("a"), False, "Is_Blank10");

    Report (Is_Continuous (""), True, "Is_Continuous1");
    Report (Is_Continuous ("a"), True, "Is_Continuous2");
    Report (Is_Continuous ("aaaa"), True, "Is_Continuous3");
    Report (Is_Continuous ("a a"), False, "Is_Continuous4");
    Report (Is_Continuous ("a "), False, "Is_Continuous5");
    Report (Is_Continuous (" a"), False, "Is_Continuous6");
    Report (Is_Continuous (Tab & "a"), False, "Is_Continuous7");
    Report (Is_Continuous ("a" & Tab), False, "Is_Continuous8");

    Report (Is_Padded ("a" & Tab), True, "Is_Padded1");
    Report (Is_Padded (Tab & "a"), True, "Is_Padded2");
    Report (Is_Padded (" a"), True, "Is_Padded3");
    Report (Is_Padded ("a "), True, "Is_Padded4");
    Report (Is_Padded ("    "), True, "Is_Padded5");
    Report (Is_Padded (Tab & "    " & Tab), True, "Is_Padded6");
    Report (Is_Padded (""), False, "Is_Padded7");
    Report (Is_Padded ("a    a"), False, "Is_Padded8");
    Report (Is_Padded ("aa"), False, "Is_Padded9");

    Report (Stripped ("aabAA", "aa", True), "b", "Stripped1 (string)");
    Report (Stripped ("aabaa", "", True), "aabaa", "Stripped2 (string)");
    Report (Stripped ("", "aa", True), "", "Stripped3 (string)");
    Report (Stripped ("agb", "aa", True), "agb", "Stripped4 (string)");
    Report (Stripped ("a", "aa", True), "a", "Stripped5 (string)");
    Report (Stripped ("aa", "aaa", False), "aa", "Stripped6 (string)");
    Report (Stripped ("aabAA", "aa", False), "bAA", "Stripped7 (string)");

    Report (Replace (1, 'K', "bgb"), "Kgb", "Replace1 (char)");
    Report (Replace (3, 'K', "bgb"), "bgK", "Replace2 (char)");
    Report (Replace (2, 'K', "bgb"), "bKb", "Replace2 (char)");

    Report (Replace (2, 4, "bop", "bgbg"), "bbop", "Replace1 (str)");
    Report (Replace (1, 1, "bop", "bgbg"), "bopgbg", "Replace2 (str)");
    Report (Replace (4, 4, "bop", "bgbg"), "bgbbop", "Replace3 (str)");

    Report (Replaced ("type_r", '_', ' ', True), "type r", "Replaced1 (char)");
    Report (Replaced ("typer_", '_', ' ', True), "typer ", "Replaced2 (char)");
    Report (Replaced ("_typer", '_', ' ', True), " typer", "Replaced3 (char)");
    Report (Replaced ("___", '_', ' ', True), "   ", "Replaced4 (char)");
    Report (Replaced ("", '_', ' ', True), "", "Replaced5 (char)");
    Report (Replaced ("AAaaAA", 'A', ' ', False), "  aa  ", "Replaced6 (char)");
    Report (Replaced ("AAaaAA", 'A', ' ', True), "      ", "Replaced7 (char)");

    Report (Replaced ("aabb", "aa", "bob", True), "bobbb", "Replaced1 (str)");
    Report (Replaced ("aaAA", "aa", "bob", False), "bobAA", "Replaced2 (str)");
    Report (Replaced ("aaAA", "aa", "bob", True), "bobbob", "Replaced3 (str)");

end Test_More_String_Utilities;

E3 Meta Data

    nblk1=6
    nid=0
    hdr6=c
        [0x00] rec0=1c rec1=00 rec2=01 rec3=034
        [0x01] rec0=12 rec1=00 rec2=02 rec3=056
        [0x02] rec0=14 rec1=00 rec2=03 rec3=022
        [0x03] rec0=12 rec1=00 rec2=04 rec3=030
        [0x04] rec0=10 rec1=00 rec2=05 rec3=08e
        [0x05] rec0=08 rec1=00 rec2=06 rec3=000
    tail 0x2170029bc815c66988881 0x42a00088462061e03