VirtualBox

Ignore:
Timestamp:
Oct 4, 2023 11:33:39 PM (15 months ago)
Author:
vboxsync
Message:

IPRT/ministring: More complete set of endsWith[I] and startsWith[I] methods.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/src/VBox/Runtime/testcase/tstIprtMiniString.cpp

    r101343 r101346  
    411411    CHECK(strTest.endsWith("ty"));
    412412    CHECK(strTest.endsWith("y"));
     413    CHECK(!strTest.endsWith("ty00", 3));
     414    CHECK(strTest.endsWith("ty00", 2));
    413415    CHECK(!strTest.endsWith(""));
     416    CHECK(!strTest.endsWith(NULL));
     417    CHECK(!strTest.endsWith(strEmpty));
     418    CHECK(!strEmpty.endsWith(""));
     419    CHECK(!strEmpty.endsWith(NULL));
     420    CHECK(!strEmpty.endsWith(strEmpty));
     421
    414422    CHECK(strTest.endsWithI("qwerty"));
    415     CHECK(strTest.endsWithI("werty"));
    416     CHECK(strTest.endsWithI("erty"));
    417     CHECK(strTest.endsWithI("rty"));
     423    CHECK(strTest.endsWithI("QWERTY"));
     424    CHECK(strTest.endsWithI("wErtY"));
     425    CHECK(strTest.endsWithI("eRty"));
     426    CHECK(strTest.endsWithI("rTy"));
    418427    CHECK(strTest.endsWithI("ty"));
    419428    CHECK(strTest.endsWithI("y"));
     429    CHECK(!strTest.endsWithI("ty000", 3));
     430    CHECK(strTest.endsWithI("ty000", 2));
    420431    CHECK(!strTest.endsWithI(""));
    421     CHECK(!strTest.endsWith(strEmpty));
     432    CHECK(!strTest.endsWithI(NULL));
     433    CHECK(!strTest.endsWithI(strEmpty));
     434    CHECK(!strEmpty.endsWithI(""));
     435    CHECK(!strEmpty.endsWithI(NULL));
     436    CHECK(!strEmpty.endsWithI(strEmpty));
    422437
    423438    /* startsWith */
     
    429444    CHECK(strTest.startsWith("qw"));
    430445    CHECK(strTest.startsWith("q"));
     446    CHECK(strTest.startsWith("q00000", 1));
     447    CHECK(strTest.startsWith("qw0000", 2));
     448    CHECK(!strTest.startsWith("qw0000", 3));
    431449    CHECK(!strTest.startsWith(""));
    432450    CHECK(!strTest.startsWith(strEmpty));
     451    CHECK(!strEmpty.startsWith(strTest));
     452    CHECK(!strEmpty.startsWith(strEmpty));
     453    CHECK(!strEmpty.startsWith(""));
     454    CHECK(!strEmpty.startsWith(NULL));
     455
     456    CHECK(strTest.startsWithI(strTest));
     457    CHECK(strTest.startsWithI("qWeRty"));
     458    CHECK(strTest.startsWithI("qWerT"));
     459    CHECK(strTest.startsWithI("qWeR"));
     460    CHECK(strTest.startsWithI("qwE"));
     461    CHECK(strTest.startsWithI("qW"));
     462    CHECK(strTest.startsWithI("q"));
     463    CHECK(strTest.startsWithI("Q00000", 1));
     464    CHECK(strTest.startsWithI("qW0000", 2));
     465    CHECK(!strTest.startsWithI("qW0000", 3));
     466    CHECK(!strTest.startsWithI(""));
     467    CHECK(!strTest.startsWithI(strEmpty));
     468    CHECK(!strEmpty.startsWithI(strTest));
     469    CHECK(!strEmpty.startsWithI(strEmpty));
     470    CHECK(!strEmpty.startsWithI(""));
     471    CHECK(!strEmpty.startsWithI(NULL));
    433472
    434473#undef CHECK
Note: See TracChangeset for help on using the changeset viewer.

© 2024 Oracle Support Privacy / Do Not Sell My Info Terms of Use Trademark Policy Automated Access Etiquette