28 lines
No EOL
660 B
Java
28 lines
No EOL
660 B
Java
package ch.usi.inf.sp.cfg;
|
|
|
|
import org.junit.jupiter.api.Test;
|
|
|
|
import java.util.Iterator;
|
|
|
|
import static org.junit.jupiter.api.Assertions.*;
|
|
|
|
class BasicBlockTest {
|
|
|
|
@Test
|
|
void newBasicBlock() {
|
|
BasicBlock bb = new BasicBlock(1);
|
|
assertEquals(1, bb.getId());
|
|
assertFalse(bb.getInstructions().iterator().hasNext());
|
|
}
|
|
|
|
@Test
|
|
void appendInstruction() {
|
|
BasicBlock bb = new BasicBlock(1);
|
|
bb.appendInstruction("i1");
|
|
bb.appendInstruction("i2");
|
|
Iterator<String> it = bb.getInstructions().iterator();
|
|
assertEquals("i1", it.next());
|
|
assertEquals("i2", it.next());
|
|
}
|
|
|
|
} |