From 1c1e2b16cafb0977e99c805f445efd103adb79e8 Mon Sep 17 00:00:00 2001 From: Timmy Jose Date: Sat, 21 Dec 2019 18:42:09 +0530 Subject: [PATCH 1/3] Reorder Scheme compilers order to pick Chez Scheme first. This fixes the issue where some Scheme compiler like mit-scheme is installed and that gets picked up first, leading to an infinite loop in the tests. Also see attached image in the PR. --- src/Compiler/Scheme/Chez.idr | 2 +- tests/Main.idr | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/src/Compiler/Scheme/Chez.idr b/src/Compiler/Scheme/Chez.idr index c60abbe..675d74f 100644 --- a/src/Compiler/Scheme/Chez.idr +++ b/src/Compiler/Scheme/Chez.idr @@ -25,7 +25,7 @@ findChez case env of Just n => pure n Nothing => do e <- firstExists [p ++ x | p <- ["/usr/bin/", "/usr/local/bin/"], - x <- ["scheme", "chez", "chezscheme9.5"]] + x <- ["chez", "chezscheme9.5", "scheme"]] pure $ fromMaybe "/usr/bin/env -S scheme" e locate : {auto c : Ref Ctxt Defs} -> diff --git a/tests/Main.idr b/tests/Main.idr index 00890f6..91b308b 100644 --- a/tests/Main.idr +++ b/tests/Main.idr @@ -125,7 +125,7 @@ findChez case env of Just n => pure $ Just n Nothing => firstExists [p ++ x | p <- ["/usr/bin/", "/usr/local/bin/"], - x <- ["scheme", "chez", "chezscheme9.5"]] + x <- ["chez", "chezscheme9.5", "scheme"]] runChezTests : String -> List String -> IO (List Bool) runChezTests prog tests From 479872290df7bd231ccf905d9556c7687930860f Mon Sep 17 00:00:00 2001 From: Christian Rasmussen Date: Sun, 22 Dec 2019 20:46:06 +0100 Subject: [PATCH 2/3] Fix Double subtraction in interpreter Fixes #171 --- src/Core/Primitives.idr | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/Core/Primitives.idr b/src/Core/Primitives.idr index 2ccf454..ffaa825 100644 --- a/src/Core/Primitives.idr +++ b/src/Core/Primitives.idr @@ -113,7 +113,7 @@ sub : Constant -> Constant -> Maybe Constant sub (BI x) (BI y) = pure $ BI (x - y) sub (I x) (I y) = pure $ I (x - y) sub (Ch x) (Ch y) = pure $ Ch (cast (cast {to=Int} x - cast y)) -sub (Db x) (Db y) = pure $ Db (x + y) +sub (Db x) (Db y) = pure $ Db (x - y) sub _ _ = Nothing mul : Constant -> Constant -> Maybe Constant From a70c68da91101ce479f7f15d7129e0cef48eab8f Mon Sep 17 00:00:00 2001 From: Christian Rasmussen Date: Sun, 22 Dec 2019 21:47:25 +0100 Subject: [PATCH 3/3] Add test for Double subtraction --- tests/Main.idr | 1 + tests/idris2/interpreter001/expected | 2 ++ tests/idris2/interpreter001/input | 2 ++ tests/idris2/interpreter001/run | 1 + 4 files changed, 6 insertions(+) create mode 100644 tests/idris2/interpreter001/expected create mode 100644 tests/idris2/interpreter001/input create mode 100755 tests/idris2/interpreter001/run diff --git a/tests/Main.idr b/tests/Main.idr index 00890f6..dab77c9 100644 --- a/tests/Main.idr +++ b/tests/Main.idr @@ -40,6 +40,7 @@ idrisTests "interface005", "interface006", "interface007", "interface008", "interface009", "interface010", "interface011", "interface012", "interface013", "interface014", + "interpreter001", "lazy001", "linear001", "linear002", "linear003", "linear004", "linear005", "linear006", "linear007", diff --git a/tests/idris2/interpreter001/expected b/tests/idris2/interpreter001/expected new file mode 100644 index 0000000..bc1a9b1 --- /dev/null +++ b/tests/idris2/interpreter001/expected @@ -0,0 +1,2 @@ +Main> 1.5 +Main> Bye for now! diff --git a/tests/idris2/interpreter001/input b/tests/idris2/interpreter001/input new file mode 100644 index 0000000..d1bebfa --- /dev/null +++ b/tests/idris2/interpreter001/input @@ -0,0 +1,2 @@ +3.5 - 2.0 +:q diff --git a/tests/idris2/interpreter001/run b/tests/idris2/interpreter001/run new file mode 100755 index 0000000..eb0755d --- /dev/null +++ b/tests/idris2/interpreter001/run @@ -0,0 +1 @@ +$1 --no-banner < input