1.1 --- a/rt/vm/src/test/java/org/apidesign/vm4brwsr/SizeOfAMethodTest.java Wed May 07 10:01:54 2014 +0200
1.2 +++ b/rt/vm/src/test/java/org/apidesign/vm4brwsr/SizeOfAMethodTest.java Wed May 07 10:45:42 2014 +0200
1.3 @@ -25,8 +25,7 @@
1.4
1.5 import java.io.IOException;
1.6 import java.io.InputStream;
1.7 -import static org.testng.Assert.assertEquals;
1.8 -import static org.testng.Assert.assertTrue;
1.9 +import static org.testng.Assert.*;
1.10 import org.testng.annotations.AfterClass;
1.11 import org.testng.annotations.BeforeClass;
1.12 import org.testng.annotations.Test;
1.13 @@ -52,6 +51,19 @@
1.14 assertEquals(method.indexOf("st"), -1, "There should be no stack operations:\n" + method);
1.15 }
1.16
1.17 + @Test public void betterConstructor() {
1.18 + String s = code;
1.19 + int beg = s.indexOf("c.initInflater__IIZ");
1.20 + int end = s.indexOf("c.initInflater__IIZ.access");
1.21 +
1.22 + assertTrue(beg > 0, "Found initInflater method in " + code);
1.23 + assertTrue(beg < end, "Found end of initInflater method in " + code);
1.24 +
1.25 + String method = s.substring(beg, end);
1.26 +
1.27 + assertEquals(method.indexOf("stA1"), -1, "No need for stA1 register:\n" + method);
1.28 + }
1.29 +
1.30 @Test public void emptyConstructorRequiresNoStack() {
1.31 String s = code;
1.32 int beg = s.indexOf("CLS.cons__V");