commons-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From mt...@apache.org
Subject svn commit: r1091674 - in /commons/sandbox/runtime/trunk/src/main/test/org/apache/commons/runtime: TestMemory.java TestReflect.java
Date Wed, 13 Apr 2011 07:02:13 GMT
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.



Mime
View raw message