OpenCores
URL https://opencores.org/ocsvn/openrisc/openrisc/trunk

Subversion Repositories openrisc

[/] [openrisc/] [trunk/] [gnu-dev/] [or1k-gcc/] [libjava/] [testsuite/] [libjava.jni/] [bytebuffer.c] - Rev 781

Go to most recent revision | Compare with Previous | Blame | View Log

#include "bytebuffer.h"
 
static void
test_buffer (JNIEnv *env, jobject buffer, const char *name)
{
  void *tmp = (*env)->GetDirectBufferAddress (env, buffer);
 
  if (tmp == NULL)
    printf ("PASS: address of %s\n", name);
  else
    printf ("FAIL: address of %s\n", name);
 
  int tmplen = (*env)->GetDirectBufferCapacity (env, buffer);
 
  if (tmplen == -1)
    printf ("PASS: length of %s\n", name);
  else
    printf ("FAIL: length of %s\n", name);
}
 
JNIEXPORT void JNICALL
Java_bytebuffer_testByteBuffer (JNIEnv *env, jclass k, jobject buffer)
{
  test_buffer (env, buffer, "java.nio.ByteBuffer");
}
 
JNIEXPORT void JNICALL
Java_bytebuffer_testCharBuffer (JNIEnv *env, jclass k, jobject buffer)
{
  test_buffer (env, buffer, "java.nio.CharBuffer");
}
 
JNIEXPORT void JNICALL
Java_bytebuffer_testDoubleBuffer (JNIEnv *env, jclass k, jobject buffer)
{
  test_buffer (env, buffer, "java.nio.DoubleBuffer");
}
 
JNIEXPORT void JNICALL
Java_bytebuffer_testFloatBuffer (JNIEnv *env, jclass k, jobject buffer)
{
  test_buffer (env, buffer, "java.nio.FloatBuffer");
}
 
JNIEXPORT void JNICALL
Java_bytebuffer_testIntBuffer (JNIEnv *env, jclass k, jobject buffer)
{
  test_buffer (env, buffer, "java.nio.IntBuffer");
}
 
JNIEXPORT void JNICALL
Java_bytebuffer_testLongBuffer (JNIEnv *env, jclass k, jobject buffer)
{
  test_buffer (env, buffer, "java.nio.LongBuffer");
}
 
JNIEXPORT void JNICALL
Java_bytebuffer_testShortBuffer (JNIEnv *env, jclass k, jobject buffer)
{
  test_buffer (env, buffer, "java.nio.ShortBuffer");
}
 
 

Go to most recent revision | Compare with Previous | Blame | View Log

powered by: WebSVN 2.1.0

© copyright 1999-2024 OpenCores.org, equivalent to Oliscience, all rights reserved. OpenCores®, registered trademark.