summaryrefslogtreecommitdiff
path: root/chapter13/src/test
diff options
context:
space:
mode:
authorCliff Click <cliffc@acm.org>2024-08-05 12:01:38 -0700
committerDibyendu Majumdar <dibyendumajumdar@users.noreply.github.com>2024-08-06 00:50:58 +0100
commit9bc99b3987f1daea61c329b9327814d9a9148ebe (patch)
treebedb434e4af4ae377a32d7250e61f30a76d452b1 /chapter13/src/test
parent0fb76e75be3a35d6b4741e9ae4378fa04868a840 (diff)
downloadSimple-9bc99b3987f1daea61c329b9327814d9a9148ebe.tar.gz
Simple-9bc99b3987f1daea61c329b9327814d9a9148ebe.zip
Fix graph draw with field names
Allow co-recursive defs
Diffstat (limited to 'chapter13/src/test')
-rw-r--r--chapter13/src/test/java/com/seaofnodes/simple/Chapter12Test.java19
1 files changed, 19 insertions, 0 deletions
diff --git a/chapter13/src/test/java/com/seaofnodes/simple/Chapter12Test.java b/chapter13/src/test/java/com/seaofnodes/simple/Chapter12Test.java
index 903fe676..e36c7577 100644
--- a/chapter13/src/test/java/com/seaofnodes/simple/Chapter12Test.java
+++ b/chapter13/src/test/java/com/seaofnodes/simple/Chapter12Test.java
@@ -102,4 +102,23 @@ return next.i;
assertEquals("Stop[ return 0; return 1; return .i; ]", stop.toString());
assertEquals(2L, Evaluator.evaluate(stop, 3));
}
+
+ @Test
+ public void testCoRecur() {
+ Parser parser = new Parser(
+"""
+struct int0 { int i; flt0? f; }
+struct flt0 { flt f; int0? i; }
+int0 i0 = new int0;
+i0.i = 17;
+flt0 f0 = new flt0;
+f0.f = 3.14;
+i0.f = f0;
+f0.i = i0;
+return f0.i.f.i.i;
+""");
+ StopNode stop = parser.parse(false).iterate(false);
+ assertEquals("return 17;", stop.toString());
+ }
+
}