summaryrefslogtreecommitdiff
path: root/chapter22/src/test/java/com
diff options
context:
space:
mode:
Diffstat (limited to 'chapter22/src/test/java/com')
-rw-r--r--chapter22/src/test/java/com/seaofnodes/simple/Chapter15Test.java4
-rw-r--r--chapter22/src/test/java/com/seaofnodes/simple/Chapter22Test.java4
-rw-r--r--chapter22/src/test/java/com/seaofnodes/simple/progs/helloWorld.smp4
3 files changed, 7 insertions, 5 deletions
diff --git a/chapter22/src/test/java/com/seaofnodes/simple/Chapter15Test.java b/chapter22/src/test/java/com/seaofnodes/simple/Chapter15Test.java
index cebbf4a0..a98e62d8 100644
--- a/chapter22/src/test/java/com/seaofnodes/simple/Chapter15Test.java
+++ b/chapter22/src/test/java/com/seaofnodes/simple/Chapter15Test.java
@@ -253,10 +253,10 @@ return new flt;
public void testBad1() {
CodeGen code = new CodeGen(
"""
-int is = new int[2];
+flt is = new int[2];
""");
try { code.parse().opto(); fail(); }
- catch( Exception e ) { assertEquals("Type *[int] is not of declared type int",e.getMessage()); }
+ catch( Exception e ) { assertEquals("Type *[int] is not of declared type flt",e.getMessage()); }
}
@Test
diff --git a/chapter22/src/test/java/com/seaofnodes/simple/Chapter22Test.java b/chapter22/src/test/java/com/seaofnodes/simple/Chapter22Test.java
index b99a01a6..de9c35c7 100644
--- a/chapter22/src/test/java/com/seaofnodes/simple/Chapter22Test.java
+++ b/chapter22/src/test/java/com/seaofnodes/simple/Chapter22Test.java
@@ -33,7 +33,7 @@ public class Chapter22Test {
@Test public void testJig1() throws IOException {
- EvalRisc5 R5 = TestRisc5.build("riscv_load", 0, 0, true);
+ EvalRisc5 R5 = TestRisc5.build("riscv_load", 0, 0, false);
int trap = R5.step(100);
assertEquals(0,trap);
// do assertEquals here
@@ -108,7 +108,7 @@ return cc.cz;
@Test @Ignore
public void testHelloWorld() throws IOException {
String src = Files.readString(Path.of("src/test/java/com/seaofnodes/simple/progs/helloWorld.smp"));
- TestC.run(src,TestC.CALL_CONVENTION,null,null,"build/objs/helloWorld","","Hello, World!",13);
+ TestC.run(src,TestC.CALL_CONVENTION,null,null,"build/objs/helloWorld","","Hello, World!",0);
}
diff --git a/chapter22/src/test/java/com/seaofnodes/simple/progs/helloWorld.smp b/chapter22/src/test/java/com/seaofnodes/simple/progs/helloWorld.smp
index 16ef4bc6..b83a055c 100644
--- a/chapter22/src/test/java/com/seaofnodes/simple/progs/helloWorld.smp
+++ b/chapter22/src/test/java/com/seaofnodes/simple/progs/helloWorld.smp
@@ -1,2 +1,4 @@
// -*- mode: java; -*-
-return sys.libc.write(1,"Hello, World!",13);
+i64 buf = "Hello, World!";
+sys.libc.write(1,buf,13);
+return 0;