diff options
| author | Cliff Click <cliffc@acm.org> | 2026-09-25 15:28:21 -0700 |
|---|---|---|
| committer | Cliff Click <cliffc@acm.org> | 2026-09-25 15:28:21 -0700 |
| commit | 29e0127170dce8964d7f85d808d1ec07426d2789 (patch) | |
| tree | f9174685beaf274f3324a08c68f2b0a7137309c2 /chapter17/src/test | |
| parent | 12bde12b2e18c8b82b1510ac4305de66d1205e1a (diff) | |
| download | Simple-pr254-fixes.tar.gz Simple-pr254-fixes.zip | |
Restrict subtraction zero peepholes to integer operandspr254-fixes
Require resolved integer mode in chapter 25 so zero subtraction preserves floating-point signed zero. Keep nonnumeric operands in the graph for subtraction diagnostics.
Add signed-zero coverage from chapter 12 and null-subtraction diagnostics from chapter 22. Confirmed the regressions fail on the original PR. Full Make suites pass in chapters 4-25 (5462 tests), including fresh chapter 25 sys.o compilation.
Diffstat (limited to 'chapter17/src/test')
| -rw-r--r-- | chapter17/src/test/java/com/seaofnodes/simple/Chapter12Test.java | 7 |
1 files changed, 7 insertions, 0 deletions
diff --git a/chapter17/src/test/java/com/seaofnodes/simple/Chapter12Test.java b/chapter17/src/test/java/com/seaofnodes/simple/Chapter12Test.java index e81f9845..f7efde96 100644 --- a/chapter17/src/test/java/com/seaofnodes/simple/Chapter12Test.java +++ b/chapter17/src/test/java/com/seaofnodes/simple/Chapter12Test.java @@ -8,6 +8,13 @@ import static org.junit.Assert.assertEquals; import static org.junit.Assert.fail; public class Chapter12Test { + @Test public void testSubZeroFloat() { + var stop = new Parser("flt x = arg; return 0-x;").parse().iterate(); + // Compare strings so +0.0 and -0.0 remain distinct. + assertEquals("0.0", Evaluator.evaluate(stop,0).toString()); + assertEquals("-1.0", Evaluator.evaluate(stop,1).toString()); + } + @Test public void testDeadNumericReturns() { for( String[] test : new String[][] { {"if(1) return 7; else return 2.5;", "7"}, |
