diff options
Diffstat (limited to 'chapter09/src/test/java/com/seaofnodes')
| -rw-r--r-- | chapter09/src/test/java/com/seaofnodes/simple/Chapter09Test.java | 20 |
1 files changed, 20 insertions, 0 deletions
diff --git a/chapter09/src/test/java/com/seaofnodes/simple/Chapter09Test.java b/chapter09/src/test/java/com/seaofnodes/simple/Chapter09Test.java index 5567299a..8103b903 100644 --- a/chapter09/src/test/java/com/seaofnodes/simple/Chapter09Test.java +++ b/chapter09/src/test/java/com/seaofnodes/simple/Chapter09Test.java @@ -137,6 +137,26 @@ while(v1+arg) { } @Test + public void testSccp() { + Parser parser = new Parser( +""" +int x = 1; +int cnt = 5; +while (cnt) { + cnt = cnt - 1; + if (x == 0) { + x = x + 1; + } +} +return x; +""" + ); + StopNode stop = parser.parse().iterate(); + assertEquals("return Phi(Loop8,1,Phi(Region26,(Phi_x+1),Phi_x));", stop.toString()); + + } + + @Test public void testWhile0() { Parser parser = new Parser("while(0) continue; if(0) arg=0;"); StopNode stop = parser.parse().iterate(); |
