summaryrefslogtreecommitdiff
path: root/chapter21/src
diff options
context:
space:
mode:
Diffstat (limited to 'chapter21/src')
-rw-r--r--chapter21/src/test/java/com/seaofnodes/simple/Chapter05Test.java15
1 files changed, 15 insertions, 0 deletions
diff --git a/chapter21/src/test/java/com/seaofnodes/simple/Chapter05Test.java b/chapter21/src/test/java/com/seaofnodes/simple/Chapter05Test.java
index d1dfd216..6ff4ac95 100644
--- a/chapter21/src/test/java/com/seaofnodes/simple/Chapter05Test.java
+++ b/chapter21/src/test/java/com/seaofnodes/simple/Chapter05Test.java
@@ -135,6 +135,21 @@ return a;
}
@Test
+ public void testMergeSameCon() {
+ CodeGen code = new CodeGen(
+"""
+int a=arg;
+if( arg==1 )
+ a=3;
+else
+ a=3;
+return a;
+""");
+ code.parse().opto();
+ assertEquals("return 3;", code.print());
+ }
+
+ @Test
public void testTrue() {
CodeGen code = new CodeGen("return true;").parse();
assertEquals("return 1;",code.print());