You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@commons.apache.org by mt...@apache.org on 2011/04/13 09:02:13 UTC
svn commit: r1091674 - in
/commons/sandbox/runtime/trunk/src/main/test/org/apache/commons/runtime:
TestMemory.java TestReflect.java
Author: mturk
Date: Wed Apr 13 07:02:12 2011
New Revision: 1091674
URL: http://svn.apache.org/viewvc?rev=1091674&view=rev
Log:
Add few more memory test cases
Modified:
commons/sandbox/runtime/trunk/src/main/test/org/apache/commons/runtime/TestMemory.java
commons/sandbox/runtime/trunk/src/main/test/org/apache/commons/runtime/TestReflect.java
Modified: commons/sandbox/runtime/trunk/src/main/test/org/apache/commons/runtime/TestMemory.java
URL: http://svn.apache.org/viewvc/commons/sandbox/runtime/trunk/src/main/test/org/apache/commons/runtime/TestMemory.java?rev=1091674&r1=1091673&r2=1091674&view=diff
==============================================================================
--- commons/sandbox/runtime/trunk/src/main/test/org/apache/commons/runtime/TestMemory.java (original)
+++ commons/sandbox/runtime/trunk/src/main/test/org/apache/commons/runtime/TestMemory.java Wed Apr 13 07:02:12 2011
@@ -31,12 +31,42 @@ public class TestMemory
Assert.assertNotNull(p);
}
- @Test(groups = { "private" }, expectedExceptions={ RuntimeException.class, NullPointerException.class })
- public void sigsegv()
+ @Test(groups = { "private" }, expectedExceptions={ NullPointerException.class })
+ public void pokeToNullPointer()
{
Pointer p = Memory.malloc();
Assert.assertNotNull(p);
Memory.poke(p, 0, 1);
}
+ @Test(groups = { "private" })
+ public void align()
+ throws Exception
+ {
+ Assert.assertEquals(4, Memory.align(3, 4));
+ Assert.assertEquals(8, Memory.align(3));
+ Assert.assertEquals(0, Memory.align(0));
+ Assert.assertEquals(0, Memory.align(-3));
+ Assert.assertEquals(-8, Memory.align(-8));
+ Assert.assertEquals(16L, Memory.align(1L, 16));
+ }
+
+ @Test(groups = { "private" }, expectedExceptions={ NullPointerException.class })
+ public void freeNullPointer()
+ throws Throwable
+ {
+ Pointer p = Memory.malloc();
+ Assert.assertNotNull(p);
+ p.free();
+ }
+
+ @Test(groups = { "private" }, expectedExceptions={ UnsupportedOperationException.class })
+ public void freeConstPointer()
+ throws Throwable
+ {
+ Pointer p = Pointer.NULL;
+ Assert.assertNotNull(p);
+ p.free();
+ }
+
}
Modified: commons/sandbox/runtime/trunk/src/main/test/org/apache/commons/runtime/TestReflect.java
URL: http://svn.apache.org/viewvc/commons/sandbox/runtime/trunk/src/main/test/org/apache/commons/runtime/TestReflect.java?rev=1091674&r1=1091673&r2=1091674&view=diff
==============================================================================
--- commons/sandbox/runtime/trunk/src/main/test/org/apache/commons/runtime/TestReflect.java (original)
+++ commons/sandbox/runtime/trunk/src/main/test/org/apache/commons/runtime/TestReflect.java Wed Apr 13 07:02:12 2011
@@ -24,7 +24,7 @@ public class TestReflect
{
@Test(groups = { "utils" })
- public void testFindClass()
+ public void findClass()
{
// Uses JNI class naming.
Class c1 = Reflect.findClass("Ljava/lang/System;");
@@ -34,7 +34,7 @@ public class TestReflect
}
@Test(groups = { "utils" })
- public void testAllocObject()
+ public void allocObject()
throws Exception
{
Class sc = Reflect.findClass("java/lang/String");
@@ -47,7 +47,7 @@ public class TestReflect
}
@Test(groups = { "utils" })
- public void testReflectedClass()
+ public void reflectedClass()
throws Exception
{
// Uses JNI class naming.