tests/libjava-mauve/src/gnu/testlet/javax/imageio/stream/IIOByteBuffer/setLength.java
branchjk_new_structure
changeset 1541 75c2e24dea9a
parent 1540 92ac284961c1
child 1542 be11db817bcf
equal deleted inserted replaced
1540:92ac284961c1 1541:75c2e24dea9a
     1 // Tags: JDK1.4
       
     2 
       
     3 // Copyright (C) 2004 Sascha Brawer <brawer@dandelis.ch>
       
     4 
       
     5 // This file is part of Mauve.
       
     6 
       
     7 // Mauve is free software; you can redistribute it and/or modify
       
     8 // it under the terms of the GNU General Public License as published by
       
     9 // the Free Software Foundation; either version 2, or (at your option)
       
    10 // any later version.
       
    11 
       
    12 // Mauve is distributed in the hope that it will be useful,
       
    13 // but WITHOUT ANY WARRANTY; without even the implied warranty of
       
    14 // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
       
    15 // GNU General Public License for more details.
       
    16 
       
    17 // You should have received a copy of the GNU General Public License
       
    18 // along with Mauve; see the file COPYING.  If not, write to
       
    19 // the Free Software Foundation, 59 Temple Place - Suite 330,
       
    20 // Boston, MA 02111-1307, USA.
       
    21 
       
    22 package gnu.testlet.javax.imageio.stream.IIOByteBuffer;
       
    23 
       
    24 import gnu.testlet.Testlet;
       
    25 import gnu.testlet.TestHarness;
       
    26 
       
    27 import javax.imageio.stream.IIOByteBuffer;
       
    28 
       
    29 
       
    30 /**
       
    31  * @author <a href="mailto:brawer@dandelis.ch">Sascha Brawer</a>
       
    32  */
       
    33 public class setLength
       
    34   implements Testlet
       
    35 {
       
    36   public void test(TestHarness h)
       
    37   {
       
    38     IIOByteBuffer buf;
       
    39     byte[] b1 = new byte[] { 1, 2, 3 };
       
    40 
       
    41     // Check #1.
       
    42     buf = new IIOByteBuffer(b1, 0, 1);
       
    43     buf.setLength(2);
       
    44     h.check(buf.getLength(), 2);
       
    45 
       
    46     // Check #2: Length greater than array length.
       
    47     buf.setLength(99);
       
    48     h.check(buf.getLength(), 99);
       
    49 
       
    50     // Check #3: Length negative.
       
    51     buf.setLength(-42);
       
    52     h.check(buf.getLength(), -42);
       
    53   }
       
    54 }