octave-bug-tracker
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[Octave-bug-tracker] [bug #56065] New function "contains"


From: Marshall
Subject: [Octave-bug-tracker] [bug #56065] New function "contains"
Date: Fri, 1 Nov 2019 18:24:09 -0400 (EDT)
User-agent: Mozilla/5.0 (Windows NT 10.0; Win64; x64; rv:70.0) Gecko/20100101 Firefox/70.0

Follow-up Comment #2, bug #56065 (project octave):

The function here doesn't work in the cases as specified by matlab. The
following are examples taken from Matlab help/documentation


        STR = 'data.tar.gz';
        P = 'tar';
        assert(contains(STR,P),true)

        chr = 'peppers, onions, and mushrooms';
        assert(contains(chr,'onion'),true);
        assert(contains(chr,'pineapples'),false);

        STR = {'abstracts.docx','data.tar.gz'};
        P = 'tar';
        assert(contains(STR,P),logical([0 1]))

        STR = 'data.tar.gz';
        P = {'docx','tar'};
        assert(contains(STR,P),true)

        str = {'Mary Ann Jones','Christopher Matthew Burns','John Paul
Smith'};
        pattern = {'Ann','Paul'};
        assert(contains(str,pattern),logical([1 0 1]))
        assert(str(contains(str,pattern)),{'Mary Ann Jones','John Paul
Smith'})

        STR ={'DATA.TAR.GZ','SUMMARY.PPT'};
        P = 'tar';
        assert(contains(STR,P,'IgnoreCase',true),logical([1 0]))

The code submitted here passes the first two cases, but not the third or
later. The third assertion should be a fundamental test that is not passed,
whereas the later assertions are 'advanced' features in order of what I think
is important (I use the fourth case frequently, but none of the later cases).

    _______________________________________________________

Reply to this item at:

  <https://savannah.gnu.org/bugs/?56065>

_______________________________________________
  Message sent via Savannah
  https://savannah.gnu.org/




reply via email to

[Prev in Thread] Current Thread [Next in Thread]