Revision: 15726
http://jikesrvm.svn.sourceforge.net/jikesrvm/?rev=15726&view=revAuthor: rgarner
Date: 2009-07-16 23:42:40 +0000 (Thu, 16 Jul 2009)
Log Message:
-----------
Unit test for the MMTk Harness' HeapEntry class
Added Paths:
-----------
rvmroot/trunk/testing/tests/mmtk/src/org/mmtk/harness/
rvmroot/trunk/testing/tests/mmtk/src/org/mmtk/harness/sanity/
rvmroot/trunk/testing/tests/mmtk/src/org/mmtk/harness/sanity/HeapEntryTest.java
Added: rvmroot/trunk/testing/tests/mmtk/src/org/mmtk/harness/sanity/HeapEntryTest.java
===================================================================
--- rvmroot/trunk/testing/tests/mmtk/src/org/mmtk/harness/sanity/HeapEntryTest.java (rev 0)
+++ rvmroot/trunk/testing/tests/mmtk/src/org/mmtk/harness/sanity/HeapEntryTest.java 2009-07-16 23:42:40 UTC (rev 15726)
@@ -0,0 +1,79 @@
+package org.mmtk.harness.sanity;
+
+import static org.junit.Assert.*;
+
+import org.junit.BeforeClass;
+import org.junit.Test;
+import org.vmmagic.unboxed.Address;
+import org.vmmagic.unboxed.ObjectReference;
+import org.vmmagic.unboxed.ArchitecturalWord;
+
+public class HeapEntryTest {
+
+ @BeforeClass
+ public static void setUpBeforeClass() throws Exception {
+ ArchitecturalWord.init();
+ }
+
+ @Test
+ public void testHashCode() {
+ assertEquals(961,new HeapEntry(ObjectReference.nullReference(),0).hashCode());
+ assertEquals(992,new HeapEntry(ObjectReference.nullReference(),1).hashCode());
+ assertEquals(963,new HeapEntry(Address.fromIntSignExtend(8).toObjectReference(),0).hashCode());
+ assertEquals(994,new HeapEntry(Address.fromIntSignExtend(8).toObjectReference(),1).hashCode());
+ }
+
+ @Test
+ public void testIsRootReachable() {
+ fail("Not yet implemented");
+ }
+
+ @Test
+ public void testGetRefCount() {
+ fail("Not yet implemented");
+ }
+
+ @Test
+ public void testIncRefCount() {
+ fail("Not yet implemented");
+ }
+
+ @Test
+ public void testSetRootReachable() {
+ fail("Not yet implemented");
+ }
+
+ @Test
+ public void testEqualsObject() {
+ ObjectReference[] references = new ObjectReference[] {
+ ObjectReference.nullReference(),
+ Address.fromIntSignExtend(0x4567890).toObjectReference()
+ };
+ int[] ids = new int[] { 0,1,2,3,4 };
+ HeapEntry[] left = new HeapEntry[references.length*ids.length];
+ HeapEntry[] right = new HeapEntry[references.length*ids.length];
+
+ for (int i=0; i < references.length; i++) {
+ for (int j=0; j < ids.length; j++) {
+ left[i*ids.length+j] = new HeapEntry(references[i],ids[j]);
+ right[i*ids.length+j] = new HeapEntry(references[i],ids[j]);
+ }
+ }
+
+ for (int i=0; i < left.length; i++) {
+ for (int j=0; j < left.length; j++) {
+ if (i == j) {
+ assertEquals(left[i],right[j]);
+ } else {
+ assertFalse(left[i].equals(right[j]));
+ }
+ }
+ }
+ }
+
+ @Test
+ public void testCompareTo() {
+ fail("Not yet implemented");
+ }
+
+}
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
------------------------------------------------------------------------------
Enter the BlackBerry Developer Challenge
This is your chance to win up to $100,000 in prizes! For a limited time,
vendors submitting new applications to BlackBerry App World(TM) will have
the opportunity to enter the BlackBerry Developer Challenge. See full prize
details at:
http://p.sf.net/sfu/Challenge_______________________________________________
Jikesrvm-commits mailing list
Jikesrvm-commits@...
https://lists.sourceforge.net/lists/listinfo/jikesrvm-commits