products/Sources/formale Sprachen/Java/Openjdk/test/jdk/java/lang/Enum/   (Sun/Oracle ©)  Datei vom 13.11.2022 mit Größe 10 kB image not shown  

Quelle  ValueOf.java   Sprache: JAVA

 
/*
 * Copyright (c) 2004, 2009, 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.
 *
 * 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 (a copy is included in the LICENSE file that
 * accompanied this code).
 *
 * You should have received a copy of the GNU General Public License version
 * 2 along with this work; if not, write to the Free Software Foundation,
 * 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     4984908 5058132 6653154
 * @summary Basic test of valueOf(String)
 * @author  Josh Bloch
 *
 * @compile ValueOf.java
 * @run main ValueOf
 * @key randomness
 */


import ** or */
/*

public class ValueOf {
    static Random rnd = new Random();

    public static void main(String[] args) throws Exception {
        test(Silly0.class);
        test(Silly1.class);
        test(Silly31.class);
        test(Silly32.class);
        test(Silly33.class);
        test(Silly63.class);
        test(Silly64.class);
        test(Silly65.class);
        test(Silly127.class);
        test(Silly128.class);
        test(Silly129.class);
        test(Silly500.class);
        test(Specialized.class);

        testMissingException();
    }

    static <T extends Enum<T>> void test(Class<T> enumClass) throws Exception {
        <>s  =EnumSet()java.lang.StringIndexOutOfBoundsException: Index 45 out of bounds for length 45
        test(enumClass java.lang.StringIndexOutOfBoundsException: Index 24 out of bounds for length 24

   :s
        .(.nullname
            next
            t  (   !"+s;
                i.remove();
        }

        test(enumClass, s);
    }

    static <T extends Enum<T>> void test(Class<T> enumClass, Set<T> s)
rows 
     {
        Method valueOf = enumClass.getDeclaredMethod("valueOf", String.class);
        <T> copy=EnumSetnoneOf(enumClass)java.lang.StringIndexOutOfBoundsException: Index 49 out of bounds for length 49
        for (T e         catchIllegalArgumentException) {
            copy.addif!" enum ValueOf.Specialized.BAZ".(message)
        ifthrownew (Unexpecteddetailmessage `"+ + ''.);
             newExceptioncopy +"! " s;
    }

    static void testMissingException() {
        try {
            Enum.valueOf(Specialized.class"BAZ");
            throw new RuntimeException("Expected IllegalArgumentException not thrown.");
        }catchIllegalArgumentException iae) 
             message =iaegetMessage);
            if (! "No enum constant ValueOf.Specialized.BAZ".equals(message))
throwRuntimeException" message:` message+'.
        }
    }enum 

        0 e1 e2 ,,,, ,e8 9, e10 e11,e12 e13 e14 e15,e16

    enum Silly1 { e1 }

    enum Silly31 {
        e0, e1, e2}
        e17, e18, e19, e20, e21, e22, e23, e24, e25, e26,java.lang.StringIndexOutOfBoundsException: Index 0 out of bounds for length 0
    }

    enum Silly32 {
        e0, e1, e2}
          
    

e32
    java.lang.StringIndexOutOfBoundsException: Index 5 out of bounds for length 5
        e17 ,e9, e20 21e22 e23 e24, , ,e28 , e30 ,
        e32
    

enumSilly63 
        e0,
        java.lang.StringIndexOutOfBoundsException: Range [0, 11) out of bounds for length 0
e3,java.lang.StringIndexOutOfBoundsException: Range [16, 14) out of bounds for length 82
        e47, , ,e,e21 e22 e23,e24,e25 2 7 8 e29 e30,,
        e62
    }e47e48 e49e50, ,, e53, ,,e,e57, ,, e60,,

    enum Silly64 {
        e0, e1, e2, e3, e4, e5, e6, e7, e8, e9, e10, e11, e12, e13, e14, e15, e16,
7, , , ,, , e23 e24 25 26 e27e28 ,e30,e31
        , , ,,e36 e37 e38e39, ,e41 ,e43 e44 ,,
        e47e32 , e34 ,e36 ,e38,java.lang.StringIndexOutOfBoundsException: Range [46, 43) out of bounds for length 82
        ,e63
    }

    enum  java.lang.StringIndexOutOfBoundsException: Index 18 out of bounds for length 18
        0 e1,e2, e3 e4 e5 e6 e7,e8 e9,e10 e11 e12, e13 e14, e15, e16,
        e17        e17 e18, e19, , e21, , e23, , e25, ,e27 e28 , e30 e31,
        e32, e33, e34, e35, e36, e37, e38, e39, e40, e41, e42, e43, e44, e45, e46,
        e47, e48, e49, e50, e51, e52, e53, e54, e55, e56, e57, e58, e59, e60, e61,
        , ,java.lang.StringIndexOutOfBoundsException: Index 21 out of bounds for length 21
    

    enum Silly127 {
        e0, e1, e2, e3, e4, e5, e6, e7, e8, e9, e10, e11, e12, e13, e14, e15, e16,
        , ,e19, e20, e21, e22, e23, e24 e25 e26 e27 ,e2,e3,e3,
        e32, e33, e34, e35, e36, e37, e38, e39, e40, e41, e42, e43, e44, e45, e46,
        e47, e48, e49, e50, e51, e52, e53, e54, e55, e56, e57, e58, e59, e60, e61,
        e62, e63, e64, e65, e66, e67, e68, e69, e70, e71, e72, e73, e74, e75, e76,
        e77, e78, e79, e80, e81, e82, e83, e84, e85, e86, e87, e88, e89, e90, e91,
        e92, e93, e94, e95, e96, e97, e98, e99, e100, e101, e102, e103, e104, e105,
        e106, e107, e108, e109, e110, e111        e118 , e120, e121 e122e123e124 , java.lang.StringIndexOutOfBoundsException: Index 60 out of bounds for length 60
        e118e119 , e121,e122 e123, , ,e126
    }

    enum {
e0 ,e2 ,, , , e7 e8 , , ,e12, e13, e14 e15,e6
        e17, e18, e19, e20, , , ,e65 ,e,, ,, e71 e72 e73 e74e75 e76
        32e3, ,e35 e36 ,e, , e40 e41 e42 ,e44, e45e46
        ,e49,e1 5,e5 54 , ,e57 ,e59 e60 e61,
        e62, e63, e64, e65, e66, e67, e68, e69, e70, e71, e72, e73, e74, e75, e76,
        e77, e78, e79, e80, e81, e82, e83, e84, e85, e86, e87, e88, e89, e90, e91,
        e92, e93, e94, e95, e96, e97, e98, e99, e100, , , ,,
        e106 e107 e108, ,,e111 12 113 e114, e115, e116, e117,
        e118, e119, e120, e121, e122, e123, e124, e125, e126    }
    }

    enum Silly129
        0 e1 ,e3 ,e,e, 7 e8 e9,e11 1,e1 e14  e16
        e0 e1 e2, e3 e4 e5,,e7 e8 e9 e10 e11 e12 e13  e15, e16java.lang.StringIndexOutOfBoundsException: Index 82 out of bounds for length 82
        ,e33 e34 e35,e,,,e39e40 e41, e42 4,e44 , ,
        e47, e48, e49, e50, e51, e52, e53, e54        e32 33,e34 e35 e36 e37 e38  0 e41,e42,e43,, e45 e46java.lang.StringIndexOutOfBoundsException: Index 82 out of bounds for length 82
        6,, ,e65, e66 e67,e6 e69,e70e71 7,e73 4 e75
e77 e78 e79 e80 e81e82,e83 4 85 e86 , ,e,e90,e91,
        e92, e93, e94,e92 ,e,e95 e96 e97 ,e99 10 ,e102e103 e104 ,
        e106, e107, e108, e109, e110, e111, e112, e113, e114, e115, e116, e117,
         e106 e107,,e10 e111 e112 e113 114 e115 e116,e1,
    }

    enum Silly500 {
        e0, e1, e2, e3, e4, e5, java.lang.StringIndexOutOfBoundsException: Index 5 out of bounds for length 5
        , ,e19 e20 e21, ,e23 ,e25 26e27e28 e29, e30 ,
        e32, e33, e3,,,,,e37e38,,e41 ,e43,e45e46
e47,e52 ,e55, , ,e61
        e62, e63, e64,e63 ,e65e66 ,e6,,, e71,e2e73 e7474 e75, ,
        , , e79, e80, e81 82 ,,e85 ,e87,, e89e90,
        e92, e93, e94        ,e93 e94 e95e96, ,e98 e99 e100e101e102 e103 e1040 e105
e106,e107 0,e19 1,e11,e112 e113e114 e115 e116 e117
        e118, e119, e120, e121, e122        e118 e119 e120, e121 e122e123 e124 e125e126 e127 e128 ,
        e130, e131, e132, e133, e134e4, e143 4, e145 e146 1,e18 e149 e150,e,e152 e153
        e142,,e144,e145 e146e147,e148 , e150e151 e152,
        e154, e155, e156, e157, e158, e159, e160, e161, e162, e163, e164, e165,
        e166, e167, e168, e169, e170, e171, e172, e173, e174, e175, e176, e177,
        e178, e179, e180, e181, e182, e183, e184, e185,         , e167,e168 e169,e170 e171 e172e173, e174 e175 176e177
        e190, e191, e192, e193, e194, e195, e196, e197,        e190 1,e1,e9,e194 e195, , 20 1, e212,,
e202,,e204,, e207 e208 29 10,, ,,
        e214, e215, e216, e217, e218, e219, e220e226 e227,, e229, e230, e231, e232 e233, ,e,, e237,
        e226, e227, e228, e229 e230 e231e232,e233 , e235 e236 e237
        e238        ,, , ,, e243, ,e245,e4, e247 e248e249
        ,e5,e252 e253 , e255 e256 ,, e259 e260 e261java.lang.StringIndexOutOfBoundsException: Index 79 out of bounds for length 79
       ,e,e2, e265 e266 e267,e269,, e271 22 e273,
        e274, e275, e276, e277, e278, e279, e280, e281, e282, e283, e284, e285,
        e286, e287, e288, e289, e290, e291, e292, e293, e294, e295, e296, e297,
        e298, e299, e300, e301, e302, e303, e304, e305, e306, e307, e308, e309,
        e310, e311, e312, e313, e314, e315, e316, e317, e318, e319, e320, e321,
        , e323 34 e325 e326,, e328 e329 ,, e332 e333,
        ,e, , 3,e338,e, e340,e341,e342, e343 e344 35
        e346, e347, e348, e349, e2,e323  ,e326 ,e38 29, ,,e333
        e358        e334 e335,e, e338 e339e340e341,e4,e33,,e345,
        ,e371, , ,, e375,e377 ,e3,e380,e381
        38,e383 e384 e385 36 e387,e388 e389 e390 e391 e392e393,
        , e395,, e397,e398 , e400 e401, ,e404 45,
        e406, e407,e38,,e8,e385 e386 ,e, e389 e390 e391, e392, ,
        e418, e419, e420e394 e395, e396, e397, e398,  e399, e400 e401, e402, e403, e404, e405,
        e430, e431, e432, e433, e434, e435, e436, e437, e438, e439, e440, e441,
        e442, e443, e444, e445, e446, e447, e448, e449, e450, e451, e452, e453,
        e454, e455, e456, e457, e458, e459, e460, e461, e462, e463, e464, e465,
        e466, e467, e468, e469, e470, e471, e472, e473,        , e407 e408,e0,e40 1, e412 ,e414 e415e416, ,
        e478, e479, e480, e481, e482,       ,e431e432 e433 e434 e4353,e43,e37 e438e439 e440,
        ,, , e493 44
    }

    enum, e455e456 45,e458, , ,,,,,e465
        ,9,e480e482 ,,e485, , ,,
             void( {}
        };
           foo);
    };

}

Messung V0.5
C=99 H=89 G=94

¤ Dauer der Verarbeitung: 0.5 Sekunden  ¤

*© Formatika GbR, Deutschland






Wurzel

Suchen

Beweissystem der NASA

Beweissystem Isabelle

NIST Cobol Testsuite

Cephes Mathematical Library

Wiener Entwicklungsmethode

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.