summaryrefslogtreecommitdiff
path: root/src/test/java/com/seaofnodes/simple/Chapter21AllocTest.java
diff options
context:
space:
mode:
authorCliff Click <cliffc@acm.org>2026-08-10 11:11:18 -0700
committerCliff Click <cliffc@acm.org>2026-10-24 15:56:44 -0700
commit741d78b6e840c88b7b183010c812ad982b342da1 (patch)
tree84a75eb7ad351bffd20cd5fb152bab032b74271c /src/test/java/com/seaofnodes/simple/Chapter21AllocTest.java
parent8d90d2292bbdb23596849c3c3d1cda2f6cad783e (diff)
downloadSimple-linear-chapter28a.tar.gz
Simple-linear-chapter28a.zip
Chapter 28a: Modules and Lazy Class Initializationlinear-chapter28a
Co-authored-by: Hsiang-Ying Fu <66062782+fuhsnn@users.noreply.github.com> Co-authored-by: fuhsnn <66062782+fuhsnn@users.noreply.github.com> Co-authored-by: Symious <14933944+symious@users.noreply.github.com> Co-authored-by: Jun Kawasaki <jun784@gmail.com> Co-authored-by: Claude Opus 5 <noreply@anthropic.com>
Diffstat (limited to 'src/test/java/com/seaofnodes/simple/Chapter21AllocTest.java')
-rw-r--r--src/test/java/com/seaofnodes/simple/Chapter21AllocTest.java55
1 files changed, 0 insertions, 55 deletions
diff --git a/src/test/java/com/seaofnodes/simple/Chapter21AllocTest.java b/src/test/java/com/seaofnodes/simple/Chapter21AllocTest.java
deleted file mode 100644
index bab7a86a..00000000
--- a/src/test/java/com/seaofnodes/simple/Chapter21AllocTest.java
+++ /dev/null
@@ -1,55 +0,0 @@
-package com.seaofnodes.simple;
-
-import java.io.IOException;
-import java.nio.file.*;
-import org.junit.Test;
-
-// Revised Chapter 20 examples introduced with native encoding.
-public class Chapter21AllocTest {
- @Test
- public void testNewtonInteger() {
- String src =
-"""
-// Newtons approximation to the square root
-val sqrt = { int x ->
- int guess = x;
- while( 1 ) {
- int next = (x/guess + guess)/2;
- if( next == guess ) return guess;
- guess = next;
- }
-};
-return sqrt(arg) + sqrt(arg+2);
-""";
- Chapter21Test.testCPU(src,"x86_64_v2", "Win64" ,40,null);
- Chapter21Test.testCPU(src,"riscv" , "SystemV",19,null);
- Chapter21Test.testCPU(src,"arm" , "SystemV",19,null);
- }
-
- @Test
- public void testNewtonFloat() throws IOException {
- String src = Files.readString(Path.of("src/test/java/com/seaofnodes/simple/progs/newtonFloat.smp"))
- + "flt farg = arg; return test_sqrt(farg) + test_sqrt(farg+2.0);";
- Chapter21Test.testCPU(src,"x86_64_v2", "SystemV",39,null);
- Chapter21Test.testCPU(src,"riscv" , "SystemV",17,null);
- Chapter21Test.testCPU(src,"arm" , "SystemV",18,null);
- }
-
- @Test
- public void testArray1() throws IOException {
- String src = Files.readString(Path.of("src/test/java/com/seaofnodes/simple/progs/array1.smp"));
- Chapter21Test.testCPU(src,"x86_64_v2", "SystemV",-1,"return .[];");
- Chapter21Test.testCPU(src,"riscv" , "SystemV", 8,"return (add,.[],(mul,.[],1000));");
- Chapter21Test.testCPU(src,"arm" , "SystemV", 5,"return (add,.[],(mul,.[],1000));");
- }
-
-
- @Test
- public void testString() throws IOException {
- String src = Files.readString(Path.of("src/test/java/com/seaofnodes/simple/progs/stringHash21.smp"));
- Chapter21Test.testCPU(src,"x86_64_v2", "SystemV", 9,null);
- Chapter21Test.testCPU(src,"riscv" , "SystemV", 3,null);
- Chapter21Test.testCPU(src,"arm" , "SystemV", 1,null);
- }
-
-}