1 26 27 package net.sourceforge.groboutils.mbtf.v1.assembler; 28 29 import org.easymock.EasyMock; 30 import org.easymock.MockControl; 31 import junit.framework.Test; 32 import junit.framework.TestCase; 33 import junit.framework.TestSuite; 34 35 36 43 public class AsmblStateSetUTest extends TestCase 44 { 45 48 private static final Class THIS_CLASS = AsmblStateUTest.class; 49 50 public AsmblStateSetUTest( String name ) 51 { 52 super( name ); 53 } 54 55 56 59 63 protected void setUp() throws Exception 64 { 65 super.setUp(); 66 67 } 69 70 71 74 75 public void testConstructor1() 76 { 77 new AsmblStateSet(); 78 } 79 80 81 public void testAddState1() 82 { 83 AsmblStateSet ats = new AsmblStateSet(); 84 ats.addState( null ); 85 AsmblState[] v = ats.getStates(); 86 assertNotNull( 87 "states returned null.", 88 v ); 89 assertEquals( 90 "states size not right.", 91 0, 92 v.length ); 93 } 94 95 96 public void testAddState2() 97 { 98 AsmblState at = new AsmblState(); 99 AsmblStateSet ats = new AsmblStateSet(); 100 ats.addState( at ); 101 AsmblState[] v = ats.getStates(); 102 assertNotNull( 103 "states returned null.", 104 v ); 105 assertEquals( 106 "states size not right.", 107 1, 108 v.length ); 109 assertEquals( 110 "states inserted not returned.", 111 at, 112 v[0] ); 113 } 114 115 116 public void testAddStates1() 117 { 118 AsmblStateSet ats = new AsmblStateSet(); 119 ats.addStates( null ); 120 AsmblState[] v = ats.getStates(); 121 assertNotNull( 122 "states returned null.", 123 v ); 124 assertEquals( 125 "states size not right.", 126 0, 127 v.length ); 128 } 129 130 131 public void testAddStates2() 132 { 133 AsmblState[] at = new AsmblState[0]; 134 AsmblStateSet ats = new AsmblStateSet(); 135 ats.addStates( at ); 136 AsmblState[] v = ats.getStates(); 137 assertNotNull( 138 "states returned null.", 139 v ); 140 assertEquals( 141 "states size not right.", 142 0, 143 v.length ); 144 } 145 146 147 public void testAddStates3() 148 { 149 AsmblState[] at = new AsmblState[1]; 150 AsmblStateSet ats = new AsmblStateSet(); 151 ats.addStates( at ); 152 AsmblState[] v = ats.getStates(); 153 assertNotNull( 154 "states returned null.", 155 v ); 156 assertEquals( 157 "states size not right.", 158 0, 159 v.length ); 160 } 161 162 163 public void testAddStates4() 164 { 165 AsmblState at = new AsmblState(); 166 AsmblState atlist[] = new AsmblState[1]; 167 atlist[0] = at; 168 AsmblStateSet ats = new AsmblStateSet(); 169 ats.addStates( atlist ); 170 AsmblState[] v = ats.getStates(); 171 assertNotNull( 172 "states returned null.", 173 v ); 174 assertEquals( 175 "states size not right.", 176 1, 177 v.length ); 178 assertEquals( 179 "states inserted not returned.", 180 at, 181 v[0] ); 182 } 183 184 185 public void testAddStates5() 186 { 187 AsmblState at = new AsmblState(); 188 AsmblState atlist[] = new AsmblState[2]; 189 atlist[0] = at; 190 AsmblStateSet ats = new AsmblStateSet(); 191 ats.addStates( atlist ); 192 AsmblState[] v = ats.getStates(); 193 assertNotNull( 194 "states returned null.", 195 v ); 196 assertEquals( 197 "states size not right.", 198 1, 199 v.length ); 200 assertEquals( 201 "states inserted not returned.", 202 at, 203 v[0] ); 204 } 205 206 207 210 211 214 215 public static Test suite() 216 { 217 TestSuite suite = new TestSuite( THIS_CLASS ); 218 219 230 return suite; 231 } 232 233 public static void main( String [] args ) 234 { 235 String [] name = { THIS_CLASS.getName() }; 236 237 240 junit.textui.TestRunner.main( name ); 241 } 242 243 244 248 protected void tearDown() throws Exception 249 { 250 252 super.tearDown(); 253 } 254 } 255 256 | Popular Tags |