Example #1
0
        void tContainsAt(String haystack, String needle, int pos, bool expectedSensitive, bool expectedIgnoreCase)
        {
            haystackAString._()._(haystack);
            haystackSubstring.Set("01" + haystack + "234", 2, haystack.Length);

            if (needle != null)
            {
                UT_EQ(expectedSensitive, haystackAString.ContainsAt(needle, pos, Case.Sensitive));
                UT_EQ(expectedIgnoreCase, haystackAString.ContainsAt(needle, pos, Case.Ignore));
                UT_EQ(expectedSensitive, haystackSubstring.ContainsAt(needle, pos, Case.Sensitive));
                UT_EQ(expectedIgnoreCase, haystackSubstring.ContainsAt(needle, pos, Case.Ignore));
                needleAString._()._(needle);
                UT_EQ(expectedSensitive, haystackAString.ContainsAt(needleAString, pos, Case.Sensitive));
                UT_EQ(expectedIgnoreCase, haystackAString.ContainsAt(needleAString, pos, Case.Ignore));
                UT_EQ(expectedSensitive, haystackSubstring.ContainsAt(needleAString, pos, Case.Sensitive));
                UT_EQ(expectedIgnoreCase, haystackSubstring.ContainsAt(needleAString, pos, Case.Ignore));

                needleSubstring.Set("XY" + needle + "Z", 2, needle.Length).Trim();
                UT_EQ(expectedSensitive, haystackAString.ContainsAt(needleSubstring, pos, Case.Sensitive));
                UT_EQ(expectedIgnoreCase, haystackAString.ContainsAt(needleSubstring, pos, Case.Ignore));
                UT_EQ(expectedSensitive, haystackSubstring.ContainsAt(needleSubstring, pos, Case.Sensitive));
                UT_EQ(expectedIgnoreCase, haystackSubstring.ContainsAt(needleSubstring, pos, Case.Ignore));
            }
            else
            {
                UT_EQ(expectedSensitive, haystackAString.ContainsAt(needle, pos, Case.Sensitive));
                UT_EQ(expectedIgnoreCase, haystackAString.ContainsAt(needle, pos, Case.Ignore));
                UT_EQ(expectedSensitive, haystackAString.ContainsAt((AString)null, pos, Case.Sensitive));
                UT_EQ(expectedIgnoreCase, haystackAString.ContainsAt((AString)null, pos, Case.Ignore));
                UT_EQ(expectedSensitive, haystackAString.ContainsAt((Substring)null, pos, Case.Sensitive));
                UT_EQ(expectedIgnoreCase, haystackAString.ContainsAt((Substring)null, pos, Case.Ignore));

                UT_EQ(expectedSensitive, haystackSubstring.ContainsAt(needle, pos, Case.Sensitive));
                UT_EQ(expectedIgnoreCase, haystackSubstring.ContainsAt(needle, pos, Case.Ignore));
                UT_EQ(expectedSensitive, haystackSubstring.ContainsAt((AString)null, pos, Case.Sensitive));
                UT_EQ(expectedIgnoreCase, haystackSubstring.ContainsAt((AString)null, pos, Case.Ignore));
                UT_EQ(expectedSensitive, haystackSubstring.ContainsAt((Substring)null, pos, Case.Sensitive));
                UT_EQ(expectedIgnoreCase, haystackSubstring.ContainsAt((Substring)null, pos, Case.Ignore));
            }
        }