summaryrefslogtreecommitdiff
path: root/chapter14/src/test/java
diff options
context:
space:
mode:
Diffstat (limited to 'chapter14/src/test/java')
-rw-r--r--chapter14/src/test/java/com/seaofnodes/simple/Chapter14Test.java13
1 files changed, 13 insertions, 0 deletions
diff --git a/chapter14/src/test/java/com/seaofnodes/simple/Chapter14Test.java b/chapter14/src/test/java/com/seaofnodes/simple/Chapter14Test.java
index 682eff15..8b3c3c9a 100644
--- a/chapter14/src/test/java/com/seaofnodes/simple/Chapter14Test.java
+++ b/chapter14/src/test/java/com/seaofnodes/simple/Chapter14Test.java
@@ -49,6 +49,19 @@ return b;
assertEquals(67L, Evaluator.evaluate(stop, 0));
}
+
+ @Test
+ public void testU8While() {
+ Parser parser = new Parser(
+"""
+u8 b = 123;
+while( b ) b = b + 456;// Truncate
+return b;
+""");
+ StopNode stop = parser.parse(false).iterate(false);
+ assertEquals("return Phi(Loop9,123,((Phi_b+456)&255));", stop.toString());
+ }
+
@Test
public void testU1() {
Parser parser = new Parser(