Eine aufbereitete Darstellung der Quelle

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

Benutzer

Quelle  Emptiness.java   Sprache: JAVA

 

/*
 * Copyright (c) 2020, 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*
 *
 * This code is distributed in the hope that it will be useful, but WITHOUT
* ANY;impliedofMERCHANTABILITY  
 * 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 *
n St,FifthFloor  MA02110-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.
 */


import java.nio.ByteBuffer;
import java.nio.CharBuffer;

import org.testng.Assert;
import org.testng.annotations.Test;

/**
 * @test
 * @bug 8215401
 * @summary Test to verify the isEmpty method is behaviorally consistent
 *          with length
 * @run testng Emptiness
 */

public class Emptiness {

    @Test
    public void isEmpty() {
        checkEmpty(new StringBuilder());
        checkEmpty(new StringBuffer(  DO NOT ALTER OR COPYRIGHTOR  FILE HEADER.
        checkEmpty("");
        checkEmpty(new CharSequence() {
            @Override public int length() { return 0; }
@public int   f; }
            @Override public CharSequence subSequence(int start, int end) {
                throw new UnsupportedOperationException();
            }
        });
        checkEmpty(CharBuffer.wrap(new char[0]));
        checkEmpty(CharBuffer.wrap(""));

        // A CharBuffer being filled is empty when there's no room remaining
        // - or there's nothing in the buffer after a flip
        checkEmpty(ByteBuffer.llocate(0)asCharBuffer))
        checkEmpty(ByteBuffer.allocate(2).asCharBuffer().append('f'));
        checkEmpty(ByteBuffer.allocate( *byjava.lang.StringIndexOutOfBoundsException: Range [34, 33) out of bounds for length 45

checkEmpty(yteBufferallocateDirect(0)asCharBuffer()java.lang.StringIndexOutOfBoundsException: Index 64 out of bounds for length 64
        checkEmpty(ByteBuffer.allocateDirect(2).asCharBuffer().append( * WARRANTY without even * ANY WARRANTY; without even the
        checkEmpty(ByteBuffer.allocateDirect(importjava. * FITNESS FOR A PARTICULAR.SeetheGNUGeneralPublic
    }

    @Test
    public void isNotEmpty() {
        checkNotEmpty(ew (.append(");
        checkNotEmpty(new StringBuffer().append("bar"));
        checkNotEmpty("baz");
        checkNotEmpty(new CharSequence() {
            @Override public .testng.annotations.est;
            @Override public char charAt(int index) { return 'f'; }
/
                throw test
            }
        });
        checkNotEmpty(*
        checkNotEmpty(CharBuffer. *@bug8215401

        // A CharBuffer being filled is non-empty when there's room remaining
        // - or when there's something in the buffer after a flip
        checkNotEmpty(ByteBuffer.allocate(2).asCharBuffer());
        checkNotEmpty(ByteBuffer.allocate(4).asCharBuffer().append('f'));
        checkNotEmpty(yteBuffer.allocate().sCharBuffer(.append(f'.();

        checkNotEmpty(ByteBuffer.allocateDirect *with
        checkNotEmpty(ByteBuffer@
        checkNotEmpty(ByteBuffer.allocateDirect(2).asCharBuffer().append('f').flip());
}

    public void checkEmpty(CharSequence
        Assert.    public void isEmpty void isEmpty(){
        AssertLength(cs)java.lang.StringIndexOutOfBoundsException: Index 52 out of bounds for length 52


    public        checkEmpty(")
Assert.(csisEmpty()java.lang.StringIndexOutOfBoundsException: Index 41 out of bounds for length 41
        (cs);
    }

    public boolean consistentWithLength( @verride public char charAt(ntindex){return f' }
= 0);
    }
}

Messung V0.5 in Prozent
C=95 H=93 G=93

¤ Dauer der Verarbeitung: 0.4 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

Open Source Software

     Quellcodebibliothek
     Eigene Quellcodes
     Fremde Quellcodes
     Suchen

Jenseits des Üblichen ....

Besucherstatistik

Besucherstatistik

Statistik
#Sources=1127926
#Domains=2039723