diff options
| author | Cliff Click <cliffc@acm.org> | 2026-10-22 15:47:50 -0700 |
|---|---|---|
| committer | Cliff Click <cliffc@acm.org> | 2026-10-22 15:47:50 -0700 |
| commit | deafd9a6fa34938c0c8c9589097e8c84e39bfa1b (patch) | |
| tree | db39ecbad856f986b84e229dbc4c023473892976 /chapter-construction/src/test/java/com/seaofnodes/simple/SccpTest.java | |
| parent | dbcaebdefff26658debc29cae284ad4aa0da4c65 (diff) | |
| download | Simple-main.tar.gz Simple-main.zip | |
Split out the constructor chaptermain
Diffstat (limited to 'chapter-construction/src/test/java/com/seaofnodes/simple/SccpTest.java')
| -rw-r--r-- | chapter-construction/src/test/java/com/seaofnodes/simple/SccpTest.java | 27 |
1 files changed, 27 insertions, 0 deletions
diff --git a/chapter-construction/src/test/java/com/seaofnodes/simple/SccpTest.java b/chapter-construction/src/test/java/com/seaofnodes/simple/SccpTest.java new file mode 100644 index 00000000..cad1b7de --- /dev/null +++ b/chapter-construction/src/test/java/com/seaofnodes/simple/SccpTest.java @@ -0,0 +1,27 @@ +package com.seaofnodes.simple; + +import com.seaofnodes.simple.codegen.CodeGen; +import com.seaofnodes.simple.node.*; +import com.seaofnodes.simple.type.TypeInteger; +import org.junit.Test; +import static org.junit.Assert.*; + +public class SccpTest { + @Test public void testCallArgumentFlow() { + var code = new CodeGen("val f={ int x -> x+1; }; return f(1)+f(2);").parse().iter().opto(); + int[] parms = {0}; + code._start.walk(n -> { + if( n instanceof ParmNode p && "x".equals(p._label) ) { + parms[0]++; + TypeInteger t = (TypeInteger)p._type; + assertEquals(1,t._min); + assertEquals(2,t._max); + assertFalse(p.fun().in(1) instanceof StartNode); + } + return null; + }); + assertEquals(1,parms[0]); + code.driver(CodeGen.Phase.LocalSched); + assertEquals("5",Eval2.eval(code,0)); + } +} |
