From 10cf538245658e6491ed6a85727ab0c64446ad86 Mon Sep 17 00:00:00 2001 From: Cliff Click Date: Mon, 30 Sep 2024 11:40:36 -0700 Subject: store-store opt checks offset --- .../src/test/java/com/seaofnodes/simple/Chapter15Test.java | 14 ++++++++++++++ 1 file changed, 14 insertions(+) (limited to 'chapter15/src/test/java') 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 @@ -46,6 +46,20 @@ return is[1]; assertEquals(0L, Evaluator.evaluate(stop, 0)); } + @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( -- cgit v1.2.3