This repository has been archived on 2024-10-22. You can view files and clone it, but cannot push or open issues or pull requests.
sp-04/test/ch/usi/inf/sp/cfg/BasicBlockTest.java
github-classroom[bot] 74a433f602
Initial commit
2023-10-18 19:57:49 +00:00

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());
}
}