/*
   * test for method static DoubleBuffer allocate(int capacity) test covers
   * following usecases: 1. case for check DoubleBuffer testBuf properties 2.
   * case expected IllegalArgumentException
   */
  @TestTargetNew(
      level = TestLevel.PARTIAL_COMPLETE,
      notes = "",
      method = "allocate",
      args = {int.class})
  public void test_AllocateI() {
    // case: DoubleBuffer testBuf properties is satisfy the conditions
    // specification
    DoubleBuffer testBuf = DoubleBuffer.allocate(20);
    assertEquals(0, testBuf.position());
    assertNotNull(testBuf.array());
    assertEquals(0, testBuf.arrayOffset());
    assertEquals(20, testBuf.limit());
    assertEquals(20, testBuf.capacity());

    testBuf = DoubleBuffer.allocate(0);
    assertEquals(0, testBuf.position());
    assertNotNull(testBuf.array());
    assertEquals(0, testBuf.arrayOffset());
    assertEquals(0, testBuf.limit());
    assertEquals(0, testBuf.capacity());

    // case: expected IllegalArgumentException
    try {
      testBuf = DoubleBuffer.allocate(-20);
      fail("allocate method does not throws expected exception");
    } catch (IllegalArgumentException e) {
      // expected
    }
  }
  public void testDuplicate() {
    buf.clear();
    buf.mark();
    buf.position(buf.limit());

    // duplicate's contents should be the same as buf
    DoubleBuffer duplicate = buf.duplicate();
    assertNotSame(buf, duplicate);
    assertEquals(buf.position(), duplicate.position());
    assertEquals(buf.limit(), duplicate.limit());
    assertEquals(buf.isReadOnly(), duplicate.isReadOnly());
    assertEquals(buf.isDirect(), duplicate.isDirect());
    assertEquals(buf.order(), duplicate.order());
    assertContentEquals(buf, duplicate);

    // duplicate's position, mark, and limit should be independent to buf
    duplicate.reset();
    assertEquals(duplicate.position(), 0);
    duplicate.clear();
    assertEquals(buf.position(), buf.limit());
    buf.reset();
    assertEquals(buf.position(), 0);

    // duplicate share the same content with buf
    // FIXME
    if (!duplicate.isReadOnly()) {
      loadTestData1(buf);
      assertContentEquals(buf, duplicate);
      loadTestData2(duplicate);
      assertContentEquals(buf, duplicate);
    }
  }
  @TestTargetNew(
      level = TestLevel.PARTIAL_COMPLETE,
      notes = "",
      method = "equals",
      args = {java.lang.Object.class})
  public void testEquals() {
    // equal to self
    assertTrue(buf.equals(buf));
    DoubleBuffer readonly = buf.asReadOnlyBuffer();
    assertTrue(buf.equals(readonly));
    DoubleBuffer duplicate = buf.duplicate();
    assertTrue(buf.equals(duplicate));

    // always false, if type mismatch
    assertFalse(buf.equals(Boolean.TRUE));

    assertTrue(buf.capacity() > 5);

    buf.limit(buf.capacity()).position(0);
    readonly.limit(readonly.capacity()).position(1);
    assertFalse(buf.equals(readonly));

    buf.limit(buf.capacity() - 1).position(0);
    duplicate.limit(duplicate.capacity()).position(0);
    assertFalse(buf.equals(duplicate));
  }
  public void testSlice() {
    assertTrue(buf.capacity() > 5);
    buf.position(1);
    buf.limit(buf.capacity() - 1);

    DoubleBuffer slice = buf.slice();
    assertEquals(buf.isReadOnly(), slice.isReadOnly());
    assertEquals(buf.isDirect(), slice.isDirect());
    assertEquals(buf.order(), slice.order());
    assertEquals(slice.position(), 0);
    assertEquals(slice.limit(), buf.remaining());
    assertEquals(slice.capacity(), buf.remaining());
    try {
      slice.reset();
      fail("Should throw Exception"); // $NON-NLS-1$
    } catch (InvalidMarkException e) {
      // expected
    }

    // slice share the same content with buf
    // FIXME:
    if (!slice.isReadOnly()) {
      loadTestData1(slice);
      assertContentLikeTestData1(buf, 1, 0, slice.capacity());
      buf.put(2, 500);
      assertEquals(slice.get(1), 500, 0.0);
    }
  }
  @TestTargetNew(
      level = TestLevel.PARTIAL_COMPLETE,
      notes = "",
      method = "compact",
      args = {})
  @AndroidOnly("Fails on RI. See comment below")
  public void testCompact() {
    // case: buffer is full
    buf.clear();
    buf.mark();
    loadTestData1(buf);
    DoubleBuffer ret = buf.compact();
    assertSame(ret, buf);
    assertEquals(buf.position(), buf.capacity());
    assertEquals(buf.limit(), buf.capacity());
    assertContentLikeTestData1(buf, 0, 0.0, buf.capacity());
    try {
      buf.reset();
      fail("Should throw Exception"); // $NON-NLS-1$
    } catch (InvalidMarkException e) {
      // expected
    }

    // case: buffer is empty
    buf.position(0);
    buf.limit(0);
    buf.mark();
    ret = buf.compact();
    assertSame(ret, buf);
    assertEquals(buf.position(), 0);
    assertEquals(buf.limit(), buf.capacity());
    assertContentLikeTestData1(buf, 0, 0.0, buf.capacity());
    try {
      // Fails on RI. Spec doesn't specify the behavior if
      // actually nothing to be done by compact(). So RI doesn't reset
      // mark position
      buf.reset();
      fail("Should throw Exception"); // $NON-NLS-1$
    } catch (InvalidMarkException e) {
      // expected
    }

    // case: normal
    assertTrue(buf.capacity() > 5);
    buf.position(1);
    buf.limit(5);
    buf.mark();
    ret = buf.compact();
    assertSame(ret, buf);
    assertEquals(buf.position(), 4);
    assertEquals(buf.limit(), buf.capacity());
    assertContentLikeTestData1(buf, 0, 1.0, 4);
    try {
      buf.reset();
      fail("Should throw Exception"); // $NON-NLS-1$
    } catch (InvalidMarkException e) {
      // expected
    }
  }
  public void testCompact() {
    // case: buffer is full
    buf.clear();
    buf.mark();
    loadTestData1(buf);
    DoubleBuffer ret = buf.compact();
    assertSame(ret, buf);
    assertEquals(buf.position(), buf.capacity());
    assertEquals(buf.limit(), buf.capacity());
    assertContentLikeTestData1(buf, 0, 0.0, buf.capacity());
    try {
      buf.reset();
      fail("Should throw Exception"); // $NON-NLS-1$
    } catch (InvalidMarkException e) {
      // expected
    }

    // case: buffer is empty
    buf.position(0);
    buf.limit(0);
    buf.mark();
    ret = buf.compact();
    assertSame(ret, buf);
    assertEquals(buf.position(), 0);
    assertEquals(buf.limit(), buf.capacity());
    assertContentLikeTestData1(buf, 0, 0.0, buf.capacity());
    try {
      buf.reset();
      fail("Should throw Exception"); // $NON-NLS-1$
    } catch (InvalidMarkException e) {
      // expected
    }

    // case: normal
    assertTrue(buf.capacity() > 5);
    buf.position(1);
    buf.limit(5);
    buf.mark();
    ret = buf.compact();
    assertSame(ret, buf);
    assertEquals(buf.position(), 4);
    assertEquals(buf.limit(), buf.capacity());
    assertContentLikeTestData1(buf, 0, 1.0, 4);
    try {
      buf.reset();
      fail("Should throw Exception"); // $NON-NLS-1$
    } catch (InvalidMarkException e) {
      // expected
    }
  }
  /*
   * test for method static DoubleBuffer wrap(double[] array, int offset, int
   * length) test covers following usecases: 1. case for check DoubleBuffer
   * buf2 properties 2. case for check equal between buf2 and double array[]
   * 3. case for check a buf2 dependens to array[] 4. case expected
   * IndexOutOfBoundsException
   */
  @TestTargetNew(
      level = TestLevel.PARTIAL_COMPLETE,
      notes = "",
      method = "wrap",
      args = {double[].class, int.class, int.class})
  public void test_Wrap$DII() {
    double array[] = new double[BUFFER_LENGTH];
    int offset = 5;
    int length = BUFFER_LENGTH - offset;
    loadTestData1(array, 0, BUFFER_LENGTH);
    DoubleBuffer buf2 = DoubleBuffer.wrap(array, offset, length);

    // case: DoubleBuffer buf2 properties is satisfy the conditions
    // specification
    assertEquals(buf2.capacity(), array.length);
    assertEquals(buf2.position(), offset);
    assertEquals(buf2.limit(), offset + length);
    assertEquals(buf2.arrayOffset(), 0);

    // case: DoubleBuffer buf2 is equal to double array[]
    assertContentEquals(buf2, array, 0, array.length);

    // case: DoubleBuffer buf2 is depended to double array[]
    loadTestData2(array, 0, buf.capacity());
    assertContentEquals(buf2, array, 0, array.length);

    // case: expected IndexOutOfBoundsException
    try {
      offset = 7;
      buf2 = DoubleBuffer.wrap(array, offset, length);
      fail("wrap method does not throws expected exception");
    } catch (IndexOutOfBoundsException e) {
      // expected
    }
  }
 /*
  * Class under test for java.nio.DoubleBuffer put(int, double)
  */
 @TestTargetNew(
     level = TestLevel.PARTIAL_COMPLETE,
     notes = "Doesn't verify ReadOnlyBufferException.",
     method = "put",
     args = {int.class, double.class})
 public void testPutintdouble() {
   buf.clear();
   for (int i = 0; i < buf.capacity(); i++) {
     assertEquals(buf.position(), 0);
     DoubleBuffer ret = buf.put(i, (double) i);
     assertEquals(buf.get(i), (double) i, 0.0);
     assertSame(ret, buf);
   }
   try {
     buf.put(-1, 0);
     fail("Should throw Exception"); // $NON-NLS-1$
   } catch (IndexOutOfBoundsException e) {
     // expected
   }
   try {
     buf.put(buf.limit(), 0);
     fail("Should throw Exception"); // $NON-NLS-1$
   } catch (IndexOutOfBoundsException e) {
     // expected
   }
 }
 public void testToString() {
   String str = buf.toString();
   assertTrue(str.indexOf("Double") >= 0 || str.indexOf("double") >= 0);
   assertTrue(str.indexOf("" + buf.position()) >= 0);
   assertTrue(str.indexOf("" + buf.limit()) >= 0);
   assertTrue(str.indexOf("" + buf.capacity()) >= 0);
 }
 @TestTargetNew(
     level = TestLevel.PARTIAL_COMPLETE,
     notes = "",
     method = "toString",
     args = {})
 public void testToString() {
   String str = buf.toString();
   assertTrue(str.indexOf("Double") >= 0 || str.indexOf("double") >= 0);
   assertTrue(str.indexOf("" + buf.position()) >= 0);
   assertTrue(str.indexOf("" + buf.limit()) >= 0);
   assertTrue(str.indexOf("" + buf.capacity()) >= 0);
 }
Beispiel #11
0
  public void testEquals() {
    // equal to self
    assertTrue(buf.equals(buf));
    DoubleBuffer readonly = buf.asReadOnlyBuffer();
    assertTrue(buf.equals(readonly));
    DoubleBuffer duplicate = buf.duplicate();
    assertTrue(buf.equals(duplicate));

    // always false, if type mismatch
    assertFalse(buf.equals(Boolean.TRUE));

    assertTrue(buf.capacity() > 5);

    buf.limit(buf.capacity()).position(0);
    readonly.limit(readonly.capacity()).position(1);
    assertFalse(buf.equals(readonly));

    buf.limit(buf.capacity() - 1).position(0);
    duplicate.limit(duplicate.capacity()).position(0);
    assertFalse(buf.equals(duplicate));
  }
  @TestTargetNew(
      level = TestLevel.PARTIAL_COMPLETE,
      notes = "",
      method = "asReadOnlyBuffer",
      args = {})
  public void testAsReadOnlyBuffer() {
    buf.clear();
    buf.mark();
    buf.position(buf.limit());

    // readonly's contents should be the same as buf
    DoubleBuffer readonly = buf.asReadOnlyBuffer();
    assertNotSame(buf, readonly);
    assertTrue(readonly.isReadOnly());
    assertEquals(buf.position(), readonly.position());
    assertEquals(buf.limit(), readonly.limit());
    assertEquals(buf.isDirect(), readonly.isDirect());
    assertEquals(buf.order(), readonly.order());
    assertContentEquals(buf, readonly);

    // readonly's position, mark, and limit should be independent to buf
    readonly.reset();
    assertEquals(readonly.position(), 0);
    readonly.clear();
    assertEquals(buf.position(), buf.limit());
    buf.reset();
    assertEquals(buf.position(), 0);

    // BEGIN android-added
    // copied from a newer version of Harmony
    DoubleBuffer dbuffer1 = DoubleBuffer.wrap(new double[] {Double.NaN});
    DoubleBuffer dbuffer2 = DoubleBuffer.wrap(new double[] {Double.NaN});
    DoubleBuffer dbuffer3 = DoubleBuffer.wrap(new double[] {42d});

    assertEquals("Failed equal comparison with NaN entry", 0, dbuffer1.compareTo(dbuffer2));
    assertEquals("Failed greater than comparison with NaN entry", 1, dbuffer3.compareTo(dbuffer1));
    assertEquals("Failed greater than comparison with NaN entry", 1, dbuffer1.compareTo(dbuffer3));
    // END android-added
  }
Beispiel #13
0
  public void testAsReadOnlyBuffer() {
    buf.clear();
    buf.mark();
    buf.position(buf.limit());

    // readonly's contents should be the same as buf
    DoubleBuffer readonly = buf.asReadOnlyBuffer();
    assertNotSame(buf, readonly);
    assertTrue(readonly.isReadOnly());
    assertEquals(buf.position(), readonly.position());
    assertEquals(buf.limit(), readonly.limit());
    assertEquals(buf.isDirect(), readonly.isDirect());
    assertEquals(buf.order(), readonly.order());
    assertContentEquals(buf, readonly);

    // readonly's position, mark, and limit should be independent to buf
    readonly.reset();
    assertEquals(readonly.position(), 0);
    readonly.clear();
    assertEquals(buf.position(), buf.limit());
    buf.reset();
    assertEquals(buf.position(), 0);
  }
  @NotNull
  public static IndexedCollection<Double> ofDouble(@NotNull ByteBuffer byteBuffer) {
    int magic = byteBuffer.getInt();
    if (magic != MAGIC) {
      throw new IllegalArgumentException("bad magic number");
    }
    int version = byteBuffer.getInt();
    if (version != VERSION) {
      throw new IllegalArgumentException("bad version number");
    }

    int size = byteBuffer.getInt();
    DoubleBuffer values = byteBuffer.asDoubleBuffer();
    values.limit(size);
    byteBuffer.position(byteBuffer.position() + size * Integer.BYTES);
    return new DoubleBufferCollection(values.slice());
  }
Beispiel #15
0
 /*
  * Class under test for double get(int)
  */
 public void testGetint() {
   buf.clear();
   for (int i = 0; i < buf.capacity(); i++) {
     assertEquals(buf.position(), i);
     assertEquals(buf.get(), buf.get(i), 0.01);
   }
   try {
     buf.get(-1);
     fail("Should throw Exception"); // $NON-NLS-1$
   } catch (IndexOutOfBoundsException e) {
     // expected
   }
   try {
     buf.get(buf.limit());
     fail("Should throw Exception"); // $NON-NLS-1$
   } catch (IndexOutOfBoundsException e) {
     // expected
   }
 }
 @TestTargetNew(
     level = TestLevel.PARTIAL_COMPLETE,
     notes = "",
     method = "compareTo",
     args = {java.nio.DoubleBuffer.class})
 public void testCompareTo() {
   DoubleBuffer other = DoubleBuffer.allocate(buf.capacity());
   loadTestData1(other);
   assertEquals(0, buf.compareTo(other));
   assertEquals(0, other.compareTo(buf));
   buf.position(1);
   assertTrue(buf.compareTo(other) > 0);
   assertTrue(other.compareTo(buf) < 0);
   other.position(2);
   assertTrue(buf.compareTo(other) < 0);
   assertTrue(other.compareTo(buf) > 0);
   buf.position(2);
   other.limit(5);
   assertTrue(buf.compareTo(other) > 0);
   assertTrue(other.compareTo(buf) < 0);
 }
Beispiel #17
0
 /*
  * Class under test for java.nio.DoubleBuffer put(int, double)
  */
 public void testPutintdouble() {
   buf.clear();
   for (int i = 0; i < buf.capacity(); i++) {
     assertEquals(buf.position(), 0);
     DoubleBuffer ret = buf.put(i, (double) i);
     assertEquals(buf.get(i), (double) i, 0.0);
     assertSame(ret, buf);
   }
   try {
     buf.put(-1, 0);
     fail("Should throw Exception"); // $NON-NLS-1$
   } catch (IndexOutOfBoundsException e) {
     // expected
   }
   try {
     buf.put(buf.limit(), 0);
     fail("Should throw Exception"); // $NON-NLS-1$
   } catch (IndexOutOfBoundsException e) {
     // expected
   }
 }
  /*
   * test for method static DoubleBuffer wrap(double[] array) test covers
   * following usecases: 1. case for check DoubleBuffer buf2 properties 2.
   * case for check equal between buf2 and double array[] 3. case for check a
   * buf2 dependens to array[]
   */
  @TestTargetNew(
      level = TestLevel.PARTIAL_COMPLETE,
      notes = "",
      method = "wrap",
      args = {double[].class})
  public void test_Wrap$D() {
    double array[] = new double[BUFFER_LENGTH];
    loadTestData1(array, 0, BUFFER_LENGTH);
    DoubleBuffer buf2 = DoubleBuffer.wrap(array);

    // case: DoubleBuffer buf2 properties is satisfy the conditions
    // specification
    assertEquals(buf2.capacity(), array.length);
    assertEquals(buf2.limit(), array.length);
    assertEquals(buf2.position(), 0);

    // case: DoubleBuffer buf2 is equal to double array[]
    assertContentEquals(buf2, array, 0, array.length);

    // case: DoubleBuffer buf2 is depended to double array[]
    loadTestData2(array, 0, buf.capacity());
    assertContentEquals(buf2, array, 0, array.length);
  }
 /*
  * Class under test for double get(int)
  */
 @TestTargetNew(
     level = TestLevel.PARTIAL_COMPLETE,
     notes = "",
     method = "get",
     args = {int.class})
 public void testGetint() {
   buf.clear();
   for (int i = 0; i < buf.capacity(); i++) {
     assertEquals(buf.position(), i);
     assertEquals(buf.get(), buf.get(i), 0.01);
   }
   try {
     buf.get(-1);
     fail("Should throw Exception"); // $NON-NLS-1$
   } catch (IndexOutOfBoundsException e) {
     // expected
   }
   try {
     buf.get(buf.limit());
     fail("Should throw Exception"); // $NON-NLS-1$
   } catch (IndexOutOfBoundsException e) {
     // expected
   }
 }
Beispiel #20
0
  public void testCompareTo() {
    DoubleBuffer other = DoubleBuffer.allocate(buf.capacity());
    loadTestData1(other);
    assertEquals(0, buf.compareTo(other));
    assertEquals(0, other.compareTo(buf));
    buf.position(1);
    assertTrue(buf.compareTo(other) > 0);
    assertTrue(other.compareTo(buf) < 0);
    other.position(2);
    assertTrue(buf.compareTo(other) < 0);
    assertTrue(other.compareTo(buf) > 0);
    buf.position(2);
    other.limit(5);
    assertTrue(buf.compareTo(other) > 0);
    assertTrue(other.compareTo(buf) < 0);

    DoubleBuffer dbuffer1 = DoubleBuffer.wrap(new double[] {Double.NaN});
    DoubleBuffer dbuffer2 = DoubleBuffer.wrap(new double[] {Double.NaN});
    DoubleBuffer dbuffer3 = DoubleBuffer.wrap(new double[] {42d});

    assertEquals("Failed equal comparison with NaN entry", 0, dbuffer1.compareTo(dbuffer2));
    assertEquals("Failed greater than comparison with NaN entry", 1, dbuffer3.compareTo(dbuffer1));
    assertEquals("Failed greater than comparison with NaN entry", 1, dbuffer1.compareTo(dbuffer3));
  }
Beispiel #21
0
  public static TestIntfPrx allTests(Ice.Communicator communicator, PrintWriter out) {
    out.print("testing stringToProxy... ");
    out.flush();
    String ref = "test:default -p 12010";
    Ice.ObjectPrx obj = communicator.stringToProxy(ref);
    test(obj != null);
    out.println("ok");

    out.print("testing checked cast... ");
    out.flush();
    TestIntfPrx t = TestIntfPrxHelper.checkedCast(obj);
    test(t != null);
    test(t.equals(obj));
    out.println("ok");

    out.print("testing custom sequences... ");
    out.flush();

    {
      //
      // Create a sequence of C instances, where elements 1..n simply point to element 0.
      //
      C[] seq = new C[5];
      seq[0] = new C();
      for (int i = 1; i < seq.length; i++) {
        seq[i] = seq[0];
      }

      //
      // Invoke each operation and verify that the returned sequences have the same
      // structure as the original.
      //
      CSeqHolder seqH = new CSeqHolder();
      C[] seqR = t.opCSeq(seq, seqH);
      test(seqR.length == seq.length);
      test(seqH.value.length == seq.length);
      for (int i = 1; i < seq.length; i++) {
        test(seqR[i] != null);
        test(seqR[i] == seqR[0]);
        test(seqR[i] == seqH.value[i]);
      }

      ArrayList<C> arr = new ArrayList<C>(Arrays.asList(seq));
      CArrayHolder arrH = new CArrayHolder();
      List<C> arrR = t.opCArray(arr, arrH);
      test(arrR.size() == arr.size());
      test(arrH.value.size() == arr.size());
      for (int i = 1; i < arr.size(); i++) {
        test(arrR.get(i) != null);
        test(arrR.get(i) == arrR.get(0));
        test(arrR.get(i) == arrH.value.get(i));
      }

      LinkedList<C> list = new LinkedList<C>(Arrays.asList(seq));
      CListHolder listH = new CListHolder();
      List<C> listR = t.opCList(list, listH);
      test(listR.size() == list.size());
      test(listH.value.size() == list.size());
      for (int i = 1; i < list.size(); i++) {
        test(listR.get(i) != null);
        test(listR.get(i) == listR.get(0));
        test(listR.get(i) == listH.value.get(i));
      }
    }

    {
      final Boolean[] seq = {
        Boolean.TRUE, Boolean.FALSE, Boolean.TRUE, Boolean.FALSE, Boolean.TRUE
      };
      ArrayList<Boolean> list = new ArrayList<Boolean>(Arrays.asList(seq));
      BoolSeqHolder listH = new BoolSeqHolder();
      List<Boolean> listR = t.opBoolSeq(list, listH);
      test(listH.value.equals(listR));
      test(listH.value.equals(list));
    }

    {
      final Byte[] seq = {
        new Byte((byte) 0), new Byte((byte) 1), new Byte((byte) 2), new Byte((byte) 3)
      };
      ArrayList<Byte> list = new ArrayList<Byte>(Arrays.asList(seq));
      ByteSeqHolder listH = new ByteSeqHolder();
      List<Byte> listR = t.opByteSeq(list, listH);
      test(listH.value.equals(listR));
      test(listH.value.equals(list));
    }

    {
      final Short[] seq = {
        new Short((short) 0), new Short((short) 1), new Short((short) 2), new Short((short) 3)
      };
      ArrayList<Short> list = new ArrayList<Short>(Arrays.asList(seq));
      ShortSeqHolder listH = new ShortSeqHolder();
      List<Short> listR = t.opShortSeq(list, listH);
      test(listH.value.equals(listR));
      test(listH.value.equals(list));
    }

    {
      final Integer[] seq = {new Integer(0), new Integer(1), new Integer(2), new Integer(3)};
      ArrayList<Integer> list = new ArrayList<Integer>(Arrays.asList(seq));
      IntSeqHolder listH = new IntSeqHolder();
      List<Integer> listR = t.opIntSeq(list, listH);
      test(listH.value.equals(listR));
      test(listH.value.equals(list));
    }

    {
      final Long[] seq = {new Long(0), new Long(1), new Long(2), new Long(3)};
      ArrayList<Long> list = new ArrayList<Long>(Arrays.asList(seq));
      LongSeqHolder listH = new LongSeqHolder();
      List<Long> listR = t.opLongSeq(list, listH);
      test(listH.value.equals(listR));
      test(listH.value.equals(list));
    }

    {
      final Float[] seq = {new Float(0), new Float(1), new Float(2), new Float(3)};
      ArrayList<Float> list = new ArrayList<Float>(Arrays.asList(seq));
      FloatSeqHolder listH = new FloatSeqHolder();
      List<Float> listR = t.opFloatSeq(list, listH);
      test(listH.value.equals(listR));
      test(listH.value.equals(list));
    }

    {
      final Double[] seq = {new Double(0), new Double(1), new Double(2), new Double(3)};
      ArrayList<Double> list = new ArrayList<Double>(Arrays.asList(seq));
      DoubleSeqHolder listH = new DoubleSeqHolder();
      List<Double> listR = t.opDoubleSeq(list, listH);
      test(listH.value.equals(listR));
      test(listH.value.equals(list));
    }

    {
      final String[] seq = {"0", "1", "2", "3", "4"};
      ArrayList<String> list = new ArrayList<String>(Arrays.asList(seq));
      StringSeqHolder listH = new StringSeqHolder();
      List<String> listR = t.opStringSeq(list, listH);
      test(listH.value.equals(listR));
      test(listH.value.equals(list));
    }

    {
      final E[] seq = {E.E1, E.E2, E.E3};
      ArrayList<E> list = new ArrayList<E>(Arrays.asList(seq));
      ESeqHolder listH = new ESeqHolder();
      List<E> listR = t.opESeq(list, listH);
      test(listH.value.equals(listR));
      test(listH.value.equals(list));
    }

    {
      S[] seq = new S[5];
      for (int i = 0; i < seq.length; i++) {
        seq[i] = new S();
        seq[i].en = E.values()[i % 3];
      }
      ArrayList<S> list = new ArrayList<S>(Arrays.asList(seq));
      SSeqHolder listH = new SSeqHolder();
      List<S> listR = t.opSSeq(list, listH);
      test(listH.value.equals(listR));
      test(listH.value.equals(list));
    }

    {
      ArrayList<Map<Integer, String>> list = new ArrayList<Map<Integer, String>>();
      for (int i = 0; i < 5; i++) {
        Map<Integer, String> m = new HashMap<Integer, String>();
        for (int j = 0; j < 4; j++) {
          m.put(j, "" + j);
        }
        list.add(m);
      }
      DSeqHolder listH = new DSeqHolder();
      List<Map<Integer, String>> listR = t.opDSeq(list, listH);
      test(listH.value.equals(listR));
      test(listH.value.equals(list));
    }

    {
      List<List<String>> seq = new LinkedList<List<String>>();
      for (int i = 0; i < 5; i++) {
        final String[] arr = {"0", "1", "2", "3", "4"};
        seq.add(new ArrayList<String>(Arrays.asList(arr)));
      }
      StringSeqSeqHolder listH = new StringSeqSeqHolder();
      List<List<String>> listR = t.opStringSeqSeq(seq, listH);
      test(listH.value.equals(listR));
      test(listH.value.equals(seq));
    }

    {
      final byte[] fullSeq = new byte[] {0, 1, 2, 3, 4, 5, 6, 7};
      final byte[] usedSeq = new byte[] {2, 3, 4, 5};

      ByteBuffer buffer = ByteBuffer.wrap(fullSeq, 2, 4);
      Ice.Holder<ByteBuffer> bufferH = new Ice.Holder<ByteBuffer>();
      ByteBuffer bufferR = t.opByteBufferSeq(buffer, bufferH);

      byte[] arr = new byte[bufferH.value.limit()];
      bufferH.value.get(arr, 0, bufferH.value.limit());
      test(Arrays.equals(arr, usedSeq));
      arr = new byte[bufferR.limit()];
      bufferR.get(arr, 0, bufferR.limit());
      test(Arrays.equals(arr, usedSeq));
    }

    {
      final short[] fullSeq = new short[] {0, 1, 2, 3, 4, 5, 6, 7};
      final short[] usedSeq = new short[] {2, 3, 4, 5};

      ShortBuffer buffer = ShortBuffer.wrap(fullSeq, 2, 4);
      Ice.Holder<ShortBuffer> bufferH = new Ice.Holder<ShortBuffer>();
      ShortBuffer bufferR = t.opShortBufferSeq(buffer, bufferH);

      short[] arr = new short[bufferH.value.limit()];
      bufferH.value.get(arr, 0, bufferH.value.limit());
      test(Arrays.equals(arr, usedSeq));
      arr = new short[bufferR.limit()];
      bufferR.get(arr, 0, bufferR.limit());
      test(Arrays.equals(arr, usedSeq));
    }

    {
      final int[] fullSeq = new int[] {0, 1, 2, 3, 4, 5, 6, 7};
      final int[] usedSeq = new int[] {2, 3, 4, 5};

      IntBuffer buffer = IntBuffer.wrap(fullSeq, 2, 4);
      Ice.Holder<IntBuffer> bufferH = new Ice.Holder<IntBuffer>();
      IntBuffer bufferR = t.opIntBufferSeq(buffer, bufferH);

      int[] arr = new int[bufferH.value.limit()];
      bufferH.value.get(arr, 0, bufferH.value.limit());
      test(Arrays.equals(arr, usedSeq));
      arr = new int[bufferR.limit()];
      bufferR.get(arr, 0, bufferR.limit());
      test(Arrays.equals(arr, usedSeq));
    }

    {
      final long[] fullSeq = new long[] {0L, 1L, 2L, 3L, 4L, 5L, 6L, 7L};
      final long[] usedSeq = new long[] {2L, 3L, 4L, 5L};

      LongBuffer buffer = LongBuffer.wrap(fullSeq, 2, 4);
      Ice.Holder<LongBuffer> bufferH = new Ice.Holder<LongBuffer>();
      LongBuffer bufferR = t.opLongBufferSeq(buffer, bufferH);

      long[] arr = new long[bufferH.value.limit()];
      bufferH.value.get(arr, 0, bufferH.value.limit());
      test(Arrays.equals(arr, usedSeq));
      arr = new long[bufferR.limit()];
      bufferR.get(arr, 0, bufferR.limit());
      test(Arrays.equals(arr, usedSeq));
    }

    {
      final float[] fullSeq = new float[] {0, 1, 2, 3, 4, 5, 6, 7};
      final float[] usedSeq = new float[] {2, 3, 4, 5};

      FloatBuffer buffer = FloatBuffer.wrap(fullSeq, 2, 4);
      Ice.Holder<FloatBuffer> bufferH = new Ice.Holder<FloatBuffer>();
      FloatBuffer bufferR = t.opFloatBufferSeq(buffer, bufferH);

      float[] arr = new float[bufferH.value.limit()];
      bufferH.value.get(arr, 0, bufferH.value.limit());
      test(Arrays.equals(arr, usedSeq));
      arr = new float[bufferR.limit()];
      bufferR.get(arr, 0, bufferR.limit());
      test(Arrays.equals(arr, usedSeq));
    }

    {
      final double[] fullSeq = new double[] {0, 1, 2, 3, 4, 5, 6, 7};
      final double[] usedSeq = new double[] {2, 3, 4, 5};

      DoubleBuffer buffer = DoubleBuffer.wrap(fullSeq, 2, 4);
      Ice.Holder<DoubleBuffer> bufferH = new Ice.Holder<DoubleBuffer>();
      DoubleBuffer bufferR = t.opDoubleBufferSeq(buffer, bufferH);

      double[] arr = new double[bufferH.value.limit()];
      bufferH.value.get(arr, 0, bufferH.value.limit());
      test(Arrays.equals(arr, usedSeq));
      arr = new double[bufferR.limit()];
      bufferR.get(arr, 0, bufferR.limit());
      test(Arrays.equals(arr, usedSeq));
    }

    out.println("ok");

    return t;
  }