diff options
| author | Cliff Click <cliffc@acm.org> | 2026-11-08 14:10:02 -0800 |
|---|---|---|
| committer | Cliff Click <cliffc@acm.org> | 2026-11-08 14:10:02 -0800 |
| commit | 06fb5aceeb65a75b1cd643debd667c52fdcafcb9 (patch) | |
| tree | c99813eaf27d98f840245302c4d6e923c964307e /chapter30/src/test/java/com/seaofnodes/simple/ConstructionGroupTest.java | |
| parent | 6560a92433a38825fd1d44d9c66ffba9f26990ff (diff) | |
| download | Simple-ch30.tar.gz Simple-ch30.zip | |
Better error messagesch30
Better error messages.
Buffs to the std lib; getch() to fetch a single character; streaming I/O handles retries, and large sizes, with better error reporting.
Formatted strings.
Default int moved to i32.
TicTacToe, the game.
Diffstat (limited to 'chapter30/src/test/java/com/seaofnodes/simple/ConstructionGroupTest.java')
| -rw-r--r-- | chapter30/src/test/java/com/seaofnodes/simple/ConstructionGroupTest.java | 8 |
1 files changed, 4 insertions, 4 deletions
diff --git a/chapter30/src/test/java/com/seaofnodes/simple/ConstructionGroupTest.java b/chapter30/src/test/java/com/seaofnodes/simple/ConstructionGroupTest.java index e544fcad..1eb64610 100644 --- a/chapter30/src/test/java/com/seaofnodes/simple/ConstructionGroupTest.java +++ b/chapter30/src/test/java/com/seaofnodes/simple/ConstructionGroupTest.java @@ -30,7 +30,7 @@ public class ConstructionGroupTest { @Test public void testCyclesAndIndependentAllocations() { String src = parent("val detached = new Child(null); payload = n+read(detached); child = new Child(self);")+ - "val p = new Parent(arg); val local = new Child(p); val par = local.parent; return (par ? par.payload : 0)+p.child.value;"; + "val p = new Parent(((arg<<32)>>32)); val local = new Child(p); val par = local.parent; return (par ? par.payload : 0)+p.child.value;"; for( long seed : new long[]{1,123,987654321} ) { CodeGen code = new CodeGen(src,seed,true).driver(CodeGen.Phase.TypeCheck); assertEquals("17",Eval2.eval(code,7)); @@ -44,7 +44,7 @@ public class ConstructionGroupTest { // Child's own slots are initialized, even though its parent remains // partial. Reading that slot does not complete the parent reference. String src = parent("child = new Child(self); payload = child.parent==null;")+ - "return new Parent(arg).payload;"; + "return new Parent(((arg<<32)>>32)).payload;"; assertEquals("0",Eval2.eval(new CodeGen(src).driver(CodeGen.Phase.TypeCheck),0)); } @@ -73,7 +73,7 @@ public class ConstructionGroupTest { } @Test public void testAliasesAndLoopBackedges() { - String src = parent("val alias = self; alias.payload = n; child = new Child(alias);")+"return new Parent(arg).child.value;"; + String src = parent("val alias = self; alias.payload = n; child = new Child(alias);")+"return new Parent(((arg<<32)>>32)).child.value;"; assertEquals("5",Eval2.eval(new CodeGen(src).driver(CodeGen.Phase.TypeCheck),3)); rejects(parent("payload = 1; child = new Child(self); Child? !c = null; while(n--) { if(c) read(c); c = child; }")+ "return 0;","ordinary function"); @@ -116,7 +116,7 @@ public class ConstructionGroupTest { head = p; }; }; - val root = new Root(arg); + val root = new Root(((arg<<32)>>32)); return root.value + root.head.value; """; CodeGen code = new CodeGen(src).driver(CodeGen.Phase.TypeCheck); |
