1 30 package org.objectweb.asm.signature; 31 32 import org.objectweb.asm.signature.SignatureReader; 33 import org.objectweb.asm.signature.SignatureWriter; 34 import org.objectweb.asm.util.TraceSignatureVisitorUnitTest; 35 import org.objectweb.asm.util.TraceSignatureVisitorUnitTest.TestData; 36 37 import junit.framework.TestCase; 38 import junit.framework.TestSuite; 39 40 46 public class SignatureUnitTest extends TestCase { 47 48 public static TestSuite suite() { 49 TestSuite suite = new TestSuite(SignatureUnitTest.class.getName()); 50 for (int i = 0; i < TraceSignatureVisitorUnitTest.DATA.length; i++) { 51 suite.addTest(new SignatureUnitTest(new TestData(TraceSignatureVisitorUnitTest.DATA[i]))); 52 } 53 return suite; 54 } 55 56 private TestData data; 57 58 private SignatureUnitTest(final TraceSignatureVisitorUnitTest.TestData data) 59 { 60 super("testSignature"); 61 this.data = data; 62 } 63 64 public void testSignature() { 65 SignatureWriter wrt = new SignatureWriter(); 66 SignatureReader rdr = new SignatureReader(data.signature); 67 switch (data.type) { 68 case 'C': 69 case 'M': 70 rdr.accept(wrt); 71 break; 72 case 'F': 73 rdr.acceptType(wrt); 74 break; 75 default: 76 return; 77 } 78 assertEquals(data.signature, wrt.toString()); 79 } 80 81 public String getName() { 82 return super.getName() + " " + data.signature; 83 } 84 } 85 | Popular Tags |