test/java/lang/String/ToLowerCase.java

Print this page

        

*** 21,31 **** * questions. */ /* @test ! @bug 4217441 4533872 4900935 8020037 @summary toLowerCase should lower-case Greek Sigma correctly depending on the context (final/non-final). Also it should handle Locale specific (lt, tr, and az) lowercasings and supplementary characters correctly. */ --- 21,31 ---- * questions. */ /* @test ! @bug 4217441 4533872 4900935 8020037 8032012 @summary toLowerCase should lower-case Greek Sigma correctly depending on the context (final/non-final). Also it should handle Locale specific (lt, tr, and az) lowercasings and supplementary characters correctly. */
*** 102,111 **** --- 102,127 ---- test("\uD801\uDC00\uD801\uDC01\uD801\uDC02", Locale.US, "\uD801\uDC28\uD801\uDC29\uD801\uDC2A"); test("\uD801\uDC00A\uD801\uDC01B\uD801\uDC02C", Locale.US, "\uD801\uDC28a\uD801\uDC29b\uD801\uDC2Ac"); // invalid code point tests: test("\uD800\uD800\uD801A\uDC00\uDC00\uDC00B", Locale.US, "\uD800\uD800\uD801a\uDC00\uDC00\uDC00b"); + // test bmp + supp1 + StringBuilder src = new StringBuilder(0x20000); + StringBuilder exp = new StringBuilder(0x20000); + for (int cp = 0; cp < 0x20000; cp++) { + if (cp >= Character.MIN_HIGH_SURROGATE && cp <= Character.MAX_HIGH_SURROGATE) { + continue; + } + int lowerCase = Character.toLowerCase(cp); + if (lowerCase == -1) { //Character.ERROR + continue; + } + src.appendCodePoint(cp); + exp.appendCodePoint(lowerCase); + } + test(src.toString(), Locale.US, exp.toString()); + } static void test(String in, Locale locale, String expected) { String result = in.toLowerCase(locale); if (!result.equals(expected)) {