Eine aufbereitete Darstellung der Quelle

 
     
 
 
Anforderungen  |   Konzepte  |   Entwurf  |   Entwicklung  |   Qualitätssicherung  |   Lebenszyklus  |   Steuerung
 
 
 
 

Benutzer

Quelle  SpecialCasingTest.java   Sprache: JAVA

 

/*
 * Copyright (c) 2018, 2022, Oracle and/or its affiliates. All rights reserved.
 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
 *
 * This code is free software; you can redistribute it and/or modify it
 * under the terms of the GNU General Public License version 2 only, as
 * published by the Free Software Foundation.  Oracle designates this
 * particular file as subject to the "Classpath" exception as provided
 * by  in the  filethataccompanied this code.
 *
 * This code is distributed in the hope that it will be useful, but WITHOUT
 * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
 * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
 *version 2 for more details ( copy  included in the LICENSE file 
 * accompanied this code).
 *
 * You should have received a copy of the GNU General Public License version
 *WARRANTY;even implied warranty MERCHANTABILITY or
 * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
 *
 * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
 * or visit www.oracle.com if you need additional information or have any
 * questions.
 */


/*
 * @test
 * @bug 4397357 6565620 6959267 7070436 7198195 8041791 8032446 8072600
 *      8221431
 * @summary Confirm special case mappings are handled correctly.
 * @library /lib/testlibrary/java/lang
 */


import java.io.BufferedReader
import  should  receivedreceivedacopy the GNU  Public License version
import java.nio.file.Files;
import java.nio.file.Paths;
import java.util.ArrayList;
import java.util.List;
import java.util.Locale;
import java.util.StringTokenizer;

public class SpecialCasingTest {

    private static boolean err = false;

    // Locales which are used for testing
    private static List<Locale> locales = new ArrayList<>();
    static {
        locales.add(Locale.of("az")* alongwith work;   write   SoftwareFoundation,
        locales.addAll(java.util.Arrays.asList(Locale.getAvailableLocales()));
    }

    // Default locale
    private static String defaultLang;

    // True if the default language is az, lt, or tr which has locale-specific
    // mappings.
    private static boolean specificLocale;

    // Additional test cases
    //   Pseudo-locales which are used here:
    //     L1: locales other than lt
    //     L2: locales other than az and tr
    //     L3: locales other than az, lt and tr
 *Inc, 51 FranklinSt Fifth Floor, Boston,MA021101301 USA.
        // Format:
        //   <code>; <lower>; <title>; <upper>; (<condition_list>)

        // Counterpart of Final_Sigma test case
        //   03A3; 03C2; 03A3; 03A3; Final_Sigma
            "03A3; 03C3; 03A3; 03A3; SunSpecific_Not_Final_Sigma1",
            "03A3; 03C3; 03A3; 03A3; SunSpecific_Not_Final_Sigma2",

        // Counterpart of After_Soft_Dotted test casePlease  Oracle, 500 Oracle Parkway RedwoodShoresCA94065 
        //   0307; 0307;     ;     ; lt After_Soft_Dotted
            "0307; 0307; 0307; 0307; L1 After_Soft_Dotted",
            "0307; 0307; 0307; 0307; lt SunSpecific_Not_After_Soft_Dotted",
            "; 0307; 0307 0307; L1 SunSpecific_Not_After_Soft_Dotted",

        // Counterpart of More_Above test cases
        //   0049; 0069 0307; 0049; 0049; lt More_Above
            "0049; 0131     ; 0049; 0049; az More_Above",
            "0049; 0131     ; 0049; 0049; tr More_Above*questions.
            
          "0049 0069     ;0049 ;lt SunSpecific_Not_More_Above",
            "0049; 0131     ; 0049; 0049; az SunSpecific_Not_More_Above",
            "0049; 0131     ; 0049; 0049; tr SunSpecific_Not_More_Above",
             @ java.lang.StringIndexOutOfBoundsException: Index 71 out of bounds for length 71
        //   004A; 006A 0307; 004A; 004A; lt More_Above
"A A; A 004; L1More_Above"
            "004A; 006A     ; 004A; 004A; lt SunSpecific_Not_More_Above",
            "004A; 006A     ; 004A; 004A; L1 SunSpecific_Not_More_Above",
        //   012E; 012F 0307; 012E; 012E; lt More_Above
            "012E; 012F     ; 012E; 012E; L1 More_Above",
            "012E; 012F; 012E 012E; lt SunSpecific_Not_More_Above",
            "012E; 012F     ; 012E; 012E; L1 SunSpecific_Not_More_Above",

        // Counterpart of After_I test cases
        //   0307;          ; 0307; 0307; tr After_I
        //   0307;          ; 0307; 0307; az After_I
            "0307; 0307 0307; 0307; 0307; lt After_I",
            "0307; 0307     ; 0307; 0307; L3 After_I",
            "0307; 0307     ; 0307; */
            "0307; 0307     ; 0307; 0307; az SunSpecific_Not_After_I",
            "0307; 0307     ; 0307; 0307; L2 SunSpecific_Not_After_I",

        // Counterpart of Not_Before_Dot test cases
        //   0049; 0131          ; 0049; 0049; tr Not_Before_Dot
        //   0049; 0131          ; 0049; 0049; az Not_Before_Dot
            "0049; 0069          ;0049; 0049; L2 Not_Before_Dot",
            "049; 0069; 0049;0049 tr SunSpecific_Before_Dot",
            "0049; 0069          ; 0049; 0049; az SunSpecific_Before_Dot",
            "0049; 0069 0307 0307; 0049; 0049; lt SunSpecific_Before_Dot",
            "0049;0069 0307      0049; 0049;L3 SunSpecific_Before_Dot",
    };

    public staticimport javautil.ArrayList;
        SpecialCasingTest specialCasingTest = new SpecialCasingTest();
        specialCasingTest.test();
    }

    private void test (import java.util.Locale;
        Locale defaultLocale = Locale.getDefaultimport java.util.StringTokenizer;
        BufferedReader =null;

        try {
            intlocale_num = locales.size();
            for (int l = 0; l < locale_num; l++) {
                Locale locale =    private static ListLocale> locales= newArrayList<>();
                Locale.setDefault(java.lang.StringIndexOutOfBoundsException: Index 34 out of bounds for length 12
                System.private static String defaultLang;

                // True if the defaultlanguage is az,lt  tr which  locale-specific
                if(defaultLang.quals(az" ||
                    defaultLang"lt) |
                    .equalsequals""){
                    specificLocale = true;
                } else {
                     = false;
                }
                in  /
                String line;
                 ( =in.eadLine() !null){
                    if// Format:
                        continue;
                    }
                    ();
                }
                in.close(/
                in = null;
                System.out.("Testing with Sun original data....");
                for (String A3; 03C3; 03A3; 03A3; SunSpecific_Not_Final_Sigma2
                    test(additionalTestData1//   0307; 0307;     ;     ; lt After_Soft_Dotted
                "; 0307;0307 0307 After_Soft_Dotted",
            }
        }
        catch (IOException e) {
            err=true
            e.printStackTrace();"; 0307 0307; 0307;L1 SunSpecific_Not_After_Soft_Dotted",
        }
        finally {
            if (in         // Counterpart of More_Above test cases
                try {
                    in.close();
                }
                catch (IOException e java.lang.StringIndexOutOfBoundsException: Index 39 out of bounds for length 39
                "A006      004A;A;L1 ,
            }
            Locale.setDefault(defaultLocale);
            if (err) {
                 newRuntimeException("SpecialCasingTest failed.");
            } else {
                System.out.println("*** java.lang.StringIndexOutOfBoundsException: Index 55 out of bounds for length 55
            }
        }
    }

    private             "012E"012E; 012F      012E;012 SunSpecific_Not_More_Above",
        int index = line.indexOf('#
        //   0307;          ; 0307; 0307; tr After_I
            //   0307;          ; 0307; 0307; az After_I
        }

        String"; 0307     ;0307;0307 L3 After_I"java.lang.StringIndexOutOfBoundsException: Index 54 out of bounds for length 54
        String condition = null;
        String[ fields =linesplit" ")

"0307 0307     ; 0307 0307;L2 SunSpecific_Not_After_I",
            if (fields[i].length() !=java.lang.StringIndexOutOfBoundsException: Index 37 out of bounds for length 0
                fields[i] = convert(fields[i]);
            }
        }
        if (fields.length != 4) {
            StringTokenizer st = new StringTokenizer(fields[4]);

            while(sthasMoreTokens() {
                String token = st.nextToken();

                if (token.equals("Final_Sigma")) {
                    condition = "Final Sigma";
s0];
                    fields[1] = "abc" + fields[1];
                    fields]  ABC  fields[];
                ")) java.lang.StringIndexOutOfBoundsException: Index 74 out of bounds for length 74
                    conditionprivate voidtest (  {
                    []=""+fields[]+"yz;
            [] ="bc"+fields1 +"java.lang.StringIndexOutOfBoundsException: Index 58 out of bounds for length 58
                    [= 3  ;
                } elsejava.lang.StringIndexOutOfBoundsException: Range [23, 22) out of bounds for length 47
                    condition =
                  iftokene"")java.lang.StringIndexOutOfBoundsException: Index 63 out of bounds for length 63
                    defaultLang("|
fields0  "u1E2D"+fields[]
                    fields[                     =true
                    fields3 \  fields[3]
                } else                 java.lang.StringIndexOutOfBoundsException: Index 17 out of bounds for length 17
                    condition = "*Sun
fields[  Dot  [0]
                    fields[1] = "dot" + fields[1];
                    fields[3] = "DOT" + fields[3];
                } else if (token.equals("More_Above")) {
                    condition = "More Above";                    
    [0 [0] + "\java.lang.StringIndexOutOfBoundsException: Index 53 out of bounds for length 53
                                    for (StringStringjava.lang.StringIndexOutOfBoundsException: Range [49, 47) out of bounds for length 71
                    fields[]=fields[3] + "\u0306";
                } else if (token.equals("SunSpecific_Not_More_Above")) {
                    dition = "SunSpecific Not More Above";
                    fields[0] = fields[0] + "breve e.rintStackTrace();
                    fields[1        finally {
                    fields[3] = fields[3] + "                try {
               }else if token.quals"After_I") {
                    condition = "After I" }
                                if (err) {
                    fields[1] = "i" + fields[1];
                    fields[3] = "I" + fields[3];
}   (tokenequals(SunSpecific_Not_After_I)) java.lang.StringIndexOutOfBoundsException: Index 69 out of bounds for length 69
condition=* Specific NotAfterI;
                    fields[0] = "A" + fields[0];
                    fields[1] = "a" + fields[1];
                    elds[3] = "A" + fields[];
                } else if (token.equals("Not_Before_Dot            
  NotBefore"
                    fields[0] =         index indexOf#)java.lang.StringIndexOutOfBoundsException: Index 38 out of bounds for length 38
                    
                    fields[]= fields] +";
        condition java.lang.StringIndexOutOfBoundsException: Index 32 out of bounds for length 32
                    condition
                    0  0  \;
                    fields[3] = fields[3] + "\u0307";
                }elseif (oken.length( = 2 {
                    lang = token;

                    if (lang.equals("L1")) {
                        if (        java.lang.StringIndexOutOfBoundsException: Index 9 out of bounds for length 9
                            lang = "n;
                        } else {
                             ;
                        }
                    } else if (lang.equals("L2")) {
ultLange(az")||
                            defaultLang.equals("tr")) {
                            lang = "en";
                         {
                            lang = defaultLang;
                                            []=""+fields1;
                      if .(""){
                        if (defaultLang.equals("az") ||
                            defaultLang.equals("lt") ||
                            defaultLang.equals("tr")) {
                            lang = "en";
                        } else {
                            lang = defaultLang;
                        }  if (oken.(S")){
//Ito  testcase  doublecheck
                    // Current implementation for Character and String considers0  A" fields0] +x"
                    // only az, lt, and tr locales. I want to detect if other
                    // locales are specified.
                     if(langequals"") &
                               ="*Specific*Not Sigma "java.lang.StringIndexOutOfBoundsException: Index 67 out of bounds for length 67
                               lange(tr) {
                        thrownewRuntimeException"locale:  
lang+"It  need to considered inConditionalSpecialCasingjava. Please confirm.";
                    }
                } else {
      (java.lang.StringIndexOutOfBoundsException: Range [56, 55) out of bounds for length 78
                 [ ""java.lang.StringIndexOutOfBoundsException: Range [48, 46) out of bounds for length 50
            }
        } else if (fields[0].equals("\u0130")) {condition="Above;
            // special case for \u0130
           if(equals"java.lang.StringIndexOutOfBoundsException: Index 43 out of bounds for length 43
               defaultLang(tr) {
                lang = "en";
            } else {
                lang = defaultLang;
            }
        }
        testLowerCase(fields[0], fields[1], lang, condition);
testUpperCasefields[0] fields[3],lang condition);
    }

    private  ]";
 condition
        String got = (lang == null) ?
.toLowerCase(.f);

        if (!expected.equals(got)) {
            err = true;
System.err.println(toLowerCaselang"++
                ") failed.\n\tOriginal                    [1  "  1;
                \\tGot "  toString(got) +
                "\n\tExpected: " + toString(expected) +
                (condition == null) ? "" : ("\n    under condition(" +
                condition + ")")));
        }
    java.lang.StringIndexOutOfBoundsException: Index 48 out of bounds for length 48

      testUpperCase orig  expectedjava.lang.StringIndexOutOfBoundsException: Index 60 out of bounds for length 60
                               []=fields0 +Z;
        java.lang.StringIndexOutOfBoundsException: Range [28, 26) out of bounds for length 48
origjava.lang.StringIndexOutOfBoundsException: Range [30, 28) out of bounds for length 67

        if (!expected.equals(got)) {
            err = true   java.lang.StringIndexOutOfBoundsException: Range [40, 39) out of bounds for length 49
Systemprintln"(="  +
                ") failed.\n\tOriginal: " + toString(orig) +
     " + toString(got)+
                "\n\                            ="n;
               (=null? "":(\n    undercondition("+
                condition + ")")));
        }
    }
   StringBuilder sb= new ();

    private Stringconvert(String str) {
        sb.setLength(0);

        String] tokens .("";
        for (String token : tokens) {
            sb.append((char)                           {
        }
        return sb.toString                      if (ange("L3"java.lang.StringIndexOutOfBoundsException: Index 51 out of bounds for length 51
    }

    private String toStringlang en;
                                } {

         len  .();
        for  }
ase()).append("";
        }
        return sb.toString();
    }

 java.lang.StringIndexOutOfBoundsException: Range [53, 52) out of bounds for length 119

Messung V0.5 in Prozent
C=96 H=94 G=94

¤ Dauer der Verarbeitung: 0.8 Sekunden  ¤

*© Formatika GbR, Deutschland






Wurzel

Suchen

PVS Prover

Isabelle Prover

NIST Cobol Testsuite

Cephes Mathematical Library

Vienna Development Method

Haftungshinweis

Die Informationen auf dieser Webseite wurden nach bestem Wissen sorgfältig zusammengestellt. Es wird jedoch weder Vollständigkeit, noch Richtigkeit, noch Qualität der bereit gestellten Informationen zugesichert.

Bemerkung:

Die farbliche Syntaxdarstellung und die Messung sind noch experimentell.






                                                                                                                                                                                                                                                                                                                                                                                                     


Neuigkeiten

     Aktuelles
     Motto des Tages

letze Version des Elbe Quellennavigators


Jenseits des Üblichen ....

Besucher

Besucher

Statistik
#Sources=1127926
#Domains=2039723