diff options
| author | Cliff Click <cliffc@acm.org> | 2024-06-30 01:58:08 +0100 |
|---|---|---|
| committer | Cliff Click <cliffc@acm.org> | 2024-10-23 17:51:09 -0700 |
| commit | dc77490c735104497851ed8c12ae5c713ab05b04 (patch) | |
| tree | 251544a95f158f4bcccc4a8d393933e638037265 /src/test/java/com/seaofnodes/simple/Chapter10Test.java | |
| parent | b933257d6b26343f3ad517f5876bb5a0093ab403 (diff) | |
| download | Simple-linear-chapter11.tar.gz Simple-linear-chapter11.zip | |
Chapter 11: Global Code Motionlinear-chapter11
Co-authored-by: Dibyendu Majumdar <mobile@majumdar.org.uk>
Co-authored-by: Thalia Archibald <thalia@archibald.dev>
Co-authored-by: Robert Obkircher <robert.obkircher@gmail.com>
Diffstat (limited to 'src/test/java/com/seaofnodes/simple/Chapter10Test.java')
| -rw-r--r-- | src/test/java/com/seaofnodes/simple/Chapter10Test.java | 26 |
1 files changed, 12 insertions, 14 deletions
diff --git a/src/test/java/com/seaofnodes/simple/Chapter10Test.java b/src/test/java/com/seaofnodes/simple/Chapter10Test.java index f2e7ca2c..7371ff18 100644 --- a/src/test/java/com/seaofnodes/simple/Chapter10Test.java +++ b/src/test/java/com/seaofnodes/simple/Chapter10Test.java @@ -1,12 +1,7 @@ package com.seaofnodes.simple; -import com.seaofnodes.simple.node.Node; import com.seaofnodes.simple.node.StopNode; -import com.seaofnodes.simple.type.*; import org.junit.Test; - -import java.util.Arrays; - import static org.junit.Assert.assertEquals; import static org.junit.Assert.fail; @@ -108,7 +103,7 @@ while (arg) { return bar.a; """); StopNode stop = parser.parse().iterate(); - assertEquals("return Phi(Loop10,0,(Phi_a+2));", stop.toString()); + assertEquals("return Phi(Loop11,0,(Phi_a+2));", stop.toString()); } @Test @@ -160,7 +155,7 @@ if( bar ) bar.a = 1; return bar; """); StopNode stop = parser.parse().iterate(); - assertEquals("return Phi(Region15,null,new Bar);", stop.toString()); + assertEquals("return Phi(Region16,null,new Bar);", stop.toString()); } @Test @@ -176,7 +171,7 @@ else bar.a = 1; return rez; """); StopNode stop = parser.parse().iterate(); - assertEquals("return Phi(Region32,4,3);", stop.toString()); + assertEquals("return Phi(Region33,4,3);", stop.toString()); } @Test @@ -193,7 +188,8 @@ while(arg) { return ret; """); try { parser.parse().iterate(); fail(); } - catch( Exception e ) { assertEquals("Might be null accessing 'v0'", e.getMessage()); } + catch( Exception e ) { + assertEquals("Might be null accessing 'v0'", e.getMessage()); } } @Test @@ -229,7 +225,7 @@ while( i.x < i.len ) { return sum; """); StopNode stop = parser.parse().iterate(); - assertEquals("return Phi(Loop14,0,(Phi(Loop,0,(Phi_x+1))+Phi_sum));", stop.toString()); + assertEquals("return Phi(Loop15,0,(Phi(Loop,0,(Phi_x+1))+Phi_sum));", stop.toString()); } @@ -245,11 +241,12 @@ while(arg) { v0.v0 = arg; arg = arg-1; if (arg==5) ret=v0; + } return ret; """); StopNode stop = parser.parse().iterate(); - assertEquals("return Phi(Loop10,new s0,Phi(Region31,new s0,Phi_ret));", stop.toString()); + assertEquals("return Phi(Loop11,new s0,Phi(Region31,new s0,Phi_ret));", stop.toString()); } @Test @@ -262,6 +259,7 @@ while(arg) { v0.v0 = arg; arg = arg-1; if (arg==5) ret=v0; + } return ret; """); @@ -283,7 +281,7 @@ while(arg < 10) { return ret; """); StopNode stop = parser.parse().iterate(); - assertEquals("return Phi(Loop10,new s0,Phi(Region30,new s0,Phi_ret));", stop.toString()); + assertEquals("return Phi(Loop11,new s0,Phi(Region30,new s0,Phi_ret));", stop.toString()); } @Test @@ -313,7 +311,7 @@ if(0) { } """); StopNode stop = parser.parse().iterate(); - assertEquals("Stop[ ]", stop.toString()); + assertEquals("return 0;", stop.toString()); } @Test @@ -387,7 +385,7 @@ while(0) {} } """); StopNode stop = parser.parse().iterate(); - assertEquals("Stop[ ]", stop.toString()); + assertEquals("return 0;", stop.toString()); } @Test |
