summaryrefslogtreecommitdiff
path: root/chapter16/src/test/java/com
diff options
context:
space:
mode:
authorCliff Click <cliffc@acm.org>2024-10-18 16:47:55 -0700
committerCliff Click <cliffc@acm.org>2024-10-21 08:52:01 -0700
commite9d9542d246a8e91a62ba9a82b9899959fd386a8 (patch)
treeeca33d540aae88e9a9fffece27def6d957683199 /chapter16/src/test/java/com
parent10db4b4946b917d9383db0464c50a49acb7d6baf (diff)
downloadSimple-e9d9542d246a8e91a62ba9a82b9899959fd386a8.tar.gz
Simple-e9d9542d246a8e91a62ba9a82b9899959fd386a8.zip
Bunch of fuzzer fixes
Mostly minor progress. Lost? shl/shr/sar high-type fixes. Turn off some printing crept back in
Diffstat (limited to 'chapter16/src/test/java/com')
-rw-r--r--chapter16/src/test/java/com/seaofnodes/simple/Chapter08Test.java2
-rw-r--r--chapter16/src/test/java/com/seaofnodes/simple/Chapter10Test.java2
-rw-r--r--chapter16/src/test/java/com/seaofnodes/simple/Chapter11Test.java21
-rw-r--r--chapter16/src/test/java/com/seaofnodes/simple/Chapter15Test.java22
4 files changed, 43 insertions, 4 deletions
diff --git a/chapter16/src/test/java/com/seaofnodes/simple/Chapter08Test.java b/chapter16/src/test/java/com/seaofnodes/simple/Chapter08Test.java
index 8117b2d6..c199b78c 100644
--- a/chapter16/src/test/java/com/seaofnodes/simple/Chapter08Test.java
+++ b/chapter16/src/test/java/com/seaofnodes/simple/Chapter08Test.java
@@ -22,7 +22,7 @@ while(arg < 10) {
}
return arg;
""");
- StopNode stop = parser.parse().iterate(true);
+ StopNode stop = parser.parse().iterate();
assertEquals("return Phi(Region45,Phi(Region32,Phi(Loop10,arg,(Phi_arg+1)),Add),Add);", stop.toString());
assertTrue(stop.ret().ctrl() instanceof RegionNode);
Assert.assertEquals(5L, Evaluator.evaluate(stop, 1));
diff --git a/chapter16/src/test/java/com/seaofnodes/simple/Chapter10Test.java b/chapter16/src/test/java/com/seaofnodes/simple/Chapter10Test.java
index 10817e04..a31dfab3 100644
--- a/chapter16/src/test/java/com/seaofnodes/simple/Chapter10Test.java
+++ b/chapter16/src/test/java/com/seaofnodes/simple/Chapter10Test.java
@@ -102,7 +102,7 @@ while (arg) {
}
return bar.a;
""");
- StopNode stop = parser.parse().iterate(true);
+ StopNode stop = parser.parse().iterate();
assertEquals("return Phi(Loop16,0,(Phi_a+2));", stop.toString());
}
diff --git a/chapter16/src/test/java/com/seaofnodes/simple/Chapter11Test.java b/chapter16/src/test/java/com/seaofnodes/simple/Chapter11Test.java
index d6278b76..d6b7bb00 100644
--- a/chapter16/src/test/java/com/seaofnodes/simple/Chapter11Test.java
+++ b/chapter16/src/test/java/com/seaofnodes/simple/Chapter11Test.java
@@ -292,7 +292,7 @@ else {
}
""");
StopNode stop = parser.parse().iterate();
- assertEquals("Stop[ return 9; return 0; return 0; return 0; ]", stop.toString());
+ assertEquals("Stop[ return 9; return 0; return 0; ]", stop.toString());
}
@@ -437,7 +437,7 @@ while( -arg )
while(1)
arg = arg+ptr.v;
""");
- StopNode stop = parser.parse().iterate(true);
+ StopNode stop = parser.parse().iterate();
assertEquals("Stop[ return 0; return 0; ]", stop.toString());
}
@@ -533,4 +533,21 @@ return 0;
assertEquals("return 0;", stop.toString());
}
+ @Test
+ public void testLoopCarriedDep() {
+ Parser parser = new Parser(
+"""
+u32 v0=0;
+{
+ int v1=0;
+ while(v1) {
+ v1=1>>>v0!=0;
+ v0=v1/0;
+ }
+}
+""");
+ StopNode stop = parser.parse().iterate();
+ assertEquals("return 0;", stop.toString());
+ }
+
}
diff --git a/chapter16/src/test/java/com/seaofnodes/simple/Chapter15Test.java b/chapter16/src/test/java/com/seaofnodes/simple/Chapter15Test.java
index 55486124..d2d60b34 100644
--- a/chapter16/src/test/java/com/seaofnodes/simple/Chapter15Test.java
+++ b/chapter16/src/test/java/com/seaofnodes/simple/Chapter15Test.java
@@ -366,4 +366,26 @@ while(0<--1>>>---(v7*0==v8)) {}
}
+ @Test
+ public void testProgress2() {
+ Parser parser = new Parser(
+"""
+if(1) {}
+else {
+ while(arg>>>0&0>>>0) {}
+ byte v3=0>>>0;
+ while(0) {}
+ int v7=0>>>0;
+ while(v7<0>>>0) {
+ while(0+v7<=0) if(1) arg=-12;
+ if(arg) {
+ v3=arg+v3+0;
+ arg=0;
+ }
+ }
+}
+""");
+ StopNode stop = parser.parse().iterate();
+ assertEquals("return 0;", stop.toString());
+ }
}