summaryrefslogtreecommitdiff
path: root/chapter15/src/test/java/com/seaofnodes
diff options
context:
space:
mode:
Diffstat (limited to 'chapter15/src/test/java/com/seaofnodes')
-rw-r--r--chapter15/src/test/java/com/seaofnodes/simple/Chapter15Test.java14
1 files changed, 14 insertions, 0 deletions
diff --git a/chapter15/src/test/java/com/seaofnodes/simple/Chapter15Test.java b/chapter15/src/test/java/com/seaofnodes/simple/Chapter15Test.java
index f08abed0..6ba6eed4 100644
--- a/chapter15/src/test/java/com/seaofnodes/simple/Chapter15Test.java
+++ b/chapter15/src/test/java/com/seaofnodes/simple/Chapter15Test.java
@@ -47,6 +47,20 @@ return is[1];
}
@Test
+ public void testBasic3() {
+ Parser parser = new Parser(
+"""
+int[] a = new int[2];
+a[0] = 1;
+a[1] = 2;
+return a[0];
+""");
+ StopNode stop = parser.parse(false).iterate(true);
+ assertEquals("return .[];", stop.toString());
+ assertEquals(1L, Evaluator.evaluate(stop, 0));
+ }
+
+ @Test
public void testRollingSum() {
Parser parser = new Parser(
"""