From a0d2771819f04b609ba0ea9c664471587e4754d5 Mon Sep 17 00:00:00 2001 From: Cliff Click Date: Wed, 24 Jul 2024 21:34:16 +0300 Subject: minor FP bugs Fix bug AddF+0, SubF+0 Fix bug flipping EQ sides. --- .../src/test/java/com/seaofnodes/simple/Chapter12Test.java | 11 +++++++++++ 1 file changed, 11 insertions(+) (limited to 'chapter12/src/test/java') diff --git a/chapter12/src/test/java/com/seaofnodes/simple/Chapter12Test.java b/chapter12/src/test/java/com/seaofnodes/simple/Chapter12Test.java index 63ceaae4..c5ea883e 100644 --- a/chapter12/src/test/java/com/seaofnodes/simple/Chapter12Test.java +++ b/chapter12/src/test/java/com/seaofnodes/simple/Chapter12Test.java @@ -37,5 +37,16 @@ return guess; assertEquals(1.414213562373095, Evaluator.evaluate(stop, 2)); } + @Test + public void testFPOps() { + Parser parser = new Parser( +""" +flt x = arg; +return x+1==x; +"""); + StopNode stop = parser.parse(false).iterate(true); + assertEquals("return (((flt)arg+1.0)==ToFloat);", stop.toString()); + assertEquals(0, Evaluator.evaluate(stop, 1)); + } } -- cgit v1.2.3