public void testStaticOverloads() { Random rnd = random(); { byte[] array = new byte[rnd.nextInt(1024)]; assertEquals(sizeOf(array), sizeOf((Object) array)); } { boolean[] array = new boolean[rnd.nextInt(1024)]; assertEquals(sizeOf(array), sizeOf((Object) array)); } { char[] array = new char[rnd.nextInt(1024)]; assertEquals(sizeOf(array), sizeOf((Object) array)); } { short[] array = new short[rnd.nextInt(1024)]; assertEquals(sizeOf(array), sizeOf((Object) array)); } { int[] array = new int[rnd.nextInt(1024)]; assertEquals(sizeOf(array), sizeOf((Object) array)); } { float[] array = new float[rnd.nextInt(1024)]; assertEquals(sizeOf(array), sizeOf((Object) array)); } { long[] array = new long[rnd.nextInt(1024)]; assertEquals(sizeOf(array), sizeOf((Object) array)); } { double[] array = new double[rnd.nextInt(1024)]; assertEquals(sizeOf(array), sizeOf((Object) array)); } }
public void testReferenceSize() { if (!isSupportedJVM()) { System.err.println("WARN: Your JVM does not support certain Oracle/Sun extensions."); System.err.println(" Memory estimates may be inaccurate."); System.err.println(" Please report this to the Lucene mailing list."); System.err.println("JVM version: " + RamUsageEstimator.JVM_INFO_STRING); System.err.println("UnsupportedFeatures:"); for (JvmFeature f : RamUsageEstimator.getUnsupportedFeatures()) { System.err.print(" - " + f.toString()); if (f == RamUsageEstimator.JvmFeature.OBJECT_ALIGNMENT) { System.err.print( "; Please note: 32bit Oracle/Sun VMs don't allow exact OBJECT_ALIGNMENT retrieval, this is a known issue."); } System.err.println(); } } assertTrue(NUM_BYTES_OBJECT_REF == 4 || NUM_BYTES_OBJECT_REF == 8); if (!Constants.JRE_IS_64BIT) { assertEquals("For 32bit JVMs, reference size must always be 4?", 4, NUM_BYTES_OBJECT_REF); } }