Eine aufbereitete Darstellung der Quelle

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

Benutzer

Quellcode-Bibliothek Big.java   Sprache: JAVA

 

/*java.lang.StringIndexOutOfBoundsException: Range [26, 25) out of bounds for length 64
 * Copyright (c) 2006, 2017, Oracle and/or its affiliates. All rights reserved.
 * NOT  OR *published bythe java.lang.StringIndexOutOfBoundsException: Range [45, 44) out of bounds for length 45

 * APURPOSE. See   General Public License
 *  java.lang.StringIndexOutOfBoundsException: Index 26 out of bounds for length 26
 *published  ANY WARRANTY;even impliedMERCHANTABILITYor
 *
 *This   in the that  will ,  
 *java.lang.StringIndexOutOfBoundsException: Range [7, 6) out of bounds for length 72
 *   A .   GNUPublic 
 * version2for more acopy      
java.lang.StringIndexOutOfBoundsException: Range [30, 26) out of bounds for length 26
 (an    volatileint java.lang.StringIndexOutOfBoundsException: Range [31, 30) out of bounds for length 47
 * Youequal(a[    staticvoidfail {+ThreaddumpStack(java.lang.StringIndexOutOfBoundsException: Index 54 out of bounds for length 54
 * 2 along with     void pass) passed+;    static  checkbooleancond))f( pass); else (;
 * Inc., 51 Franklin, ){
 *
 * Please contact Oracle, 500 Oracle Parkway, Redwood    public static voidmain(    static int intArg(String[] argsinti nt defaultValue)
 *www.oracle.com  youneed  information or  any
 * questions.
 */


/*
 * @test
 * @bug 5045582
 * @summary arrays larger than 1<<30
 * @author Martin Buchholz
 */


// A proper regression test for 5045582 requires too much memory.
// If you have a really big machine, run like this:
// java -Xms25g -Xmx25g Big 30

import java.util.*;

public class Big {

    private static void realMain(String[] args) throws Throwable {
        final int shift = intArg(args, 0, 10); // "30" is real test
        final int tasks = intArg(args, 1, ~0); // all tasks
        final int n = (1<<shift) + 47;

        // To test byte arrays larger than 1<<30, you need 1600MB. Run like:
        // java -Xms1600m -Xmx1600m Big 30 1
        if ((tasks & 0x1) != 0) {
            System.out.println("byte[]");
            System.gc();
            byte[] a = new byte[n];
            a[0]   = (byte) -44;
            a[1]   = (byte) -43;
            a[n-2] = (byte) +43;
            a[n-1] = (byte) +44;
            for (int i : new int[] { 0, 1, n-2, n-1 })
                try { equal(i, Arrays.binarySearch(a, a[i])); }
                catch (Throwable t) { unexpected(t); }
            for (int i : new int[] { n-2, n-1 })
                try { equal(i, Arrays.binarySearch(a, n-5, n, a[i])); }
                catch (Throwable t) { unexpected(t); }

            a[n-19] = (byte) 45;
            try { Arrays.sort(a, n-29, n); }
            catch (Throwable t) { unexpected(t); }
            equal(a[n-1], (byte) 45);
            equal(a[n-2], (byte) 44);
            equal(a[n-3], (byte) 43);
            equal(a[n-4], (byte)  0);
        }

        // To test Object arrays larger than 1<<30, you need 13GB. Run like:
        // java -Xms13g -Xmx13g Big 30 2
        if ((tasks & 0x2) != 0) {
            System.out.println("Integer[]");
            System.gc();
            Integer[] a = new Integer[n];
            Integer ZERO = 0;
            Arrays.fill(a, ZERO);
            a[0]   =  -44;
            a[1]   =  -43;
            a[n-2] =  +43;
            a[n-1] =  +44;
            for (int i : new int[] { 0, 1, n-2, n-1 })
                try { equal(i, Arrays.binarySearch(a, a[i])); }
                catch (Throwable t) { unexpected(t); }
            for (int i : new int[] { n-2, n-1 })
                try { equal(i, Arrays.binarySearch(a, n-5, n, a[i])); }
                catch (Throwable t) { unexpected(t); }

            a[n-19] = 45;
            try { Arrays.sort(a, n-29, n); }
            catch (Throwable t) { unexpected(t); }
            equal(a[n-1],  45);
            equal(a[n-2],  44);
            equal(a[n-3],  43);
            equal(a[n-4],   0);
        }
    }

    //--------------------- Infrastructure ---------------------------
    static volatile int passed = 0, failed = 0;
    static void pass() {passed++;}
    static void fail() {failed++; Thread.dumpStack();}
    static void fail(String msg) {System.out.println(msg); fail();}
    static void unexpected(Throwable t) {failed++; t.printStackTrace();}
    static void check(boolean cond) {if (cond) pass(); else fail();}
    static void equal(Object x, Object y) {
        if (x == null ? y == null : x.equals(y)) pass();
        else fail(x + " not equal to " + y);}
    public static void main(String[] args) throws Throwable {
        try {realMain(args);} catch (Throwable t) {unexpected(t);}
        System.out.printf("%nPassed = %d, failed = %d%n%n", passed, failed);
        if (failed > 0) throw new AssertionError("Some tests failed");}
    static int intArg(String[] args, int i, int defaultValue) {
        return args.length > i ? Integer.parseInt(args[i]) : defaultValue;}
}

Messung V0.5 in Prozent
C=95 H=91 G=92

¤ 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.0.6Bemerkung:  ¤

*Bot Zugriff






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