Package com.orientechnologies.common.directmemory

Examples of com.orientechnologies.common.directmemory.ODirectMemory.free()


    long pointer = directMemory.allocate(OLongSerializer.LONG_SIZE);
    directMemory.setLong(pointer, value);

    Assert.assertEquals(directMemory.getLong(pointer), value);

    directMemory.free(pointer);
  }

  public void testInt() {
    final Random rnd = new Random();
    ODirectMemory directMemory = new OJNADirectMemory();
View Full Code Here


    long pointer = directMemory.allocate(OIntegerSerializer.INT_SIZE);
    directMemory.setInt(pointer, value);

    Assert.assertEquals(directMemory.getInt(pointer), value);

    directMemory.free(pointer);
  }

  public void testChar() {
    final Random rnd = new Random();
    ODirectMemory directMemory = new OJNADirectMemory();
View Full Code Here

    long pointer = directMemory.allocate(OCharSerializer.CHAR_SIZE);
    directMemory.setChar(pointer, value);

    Assert.assertEquals(directMemory.getChar(pointer), value);

    directMemory.free(pointer);
  }

  public void testByte() {
    final Random rnd = new Random();
    ODirectMemory directMemory = new OJNADirectMemory();
View Full Code Here

    long pointer = directMemory.allocate(1);
    directMemory.setByte(pointer, value[0]);

    Assert.assertEquals(directMemory.getByte(pointer), value[0]);

    directMemory.free(pointer);
  }


  public void testBytesWithoutOffset() {
    final Random rnd = new Random();
View Full Code Here

    byte[] expectedResult = new byte[value.length];
    System.arraycopy(value, 0, expectedResult, expectedResult.length / 2, expectedResult.length / 2);

    Assert.assertEquals(result, expectedResult);

    directMemory.free(pointer);
  }

  public void testBytesWithOffset() {
    final Random rnd = new Random();
    ODirectMemory directMemory = new OJNADirectMemory();
View Full Code Here

    long pointer = directMemory.allocate(value.length);
    directMemory.set(pointer, value, value.length / 2, value.length / 2);

    Assert.assertEquals(directMemory.get(pointer, value.length / 2), Arrays.copyOfRange(value, value.length / 2, value.length));

    directMemory.free(pointer);
  }

  public void testCopyData() {
    final Random rnd = new Random();
    ODirectMemory directMemory = new OJNADirectMemory();
View Full Code Here

    System.arraycopy(value, 0, value, value.length / 2, value.length / 2);

    Assert.assertEquals(value, directMemory.get(pointer, value.length));

    directMemory.free(pointer);
  }

  public void testCopyDataOverlap() {
    final Random rnd = new Random();
    ODirectMemory directMemory = new OJNADirectMemory();
View Full Code Here

    System.arraycopy(value, 0, value, 1, value.length / 3);

    Assert.assertEquals(value, directMemory.get(pointer, value.length));

    directMemory.free(pointer);
  }

  public void testCopyDataOverlapInterval() {
    final Random rnd = new Random();
    ODirectMemory directMemory = new OJNADirectMemory();
View Full Code Here

    System.arraycopy(value, 2, value, 5, value.length / 3);

    Assert.assertEquals(value, directMemory.get(pointer, value.length));

    directMemory.free(pointer);
  }

}
View Full Code Here

TOP
Copyright © 2018 www.massapi.com. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.