From dca6b585784eeb32e85353efaa0d0fa1a5a9a5aa Mon Sep 17 00:00:00 2001 From: Joel Martin Date: Mon, 14 Mar 2016 23:39:21 -0500 Subject: [PATCH] Tests: move step5 non-TCO tests to per impl. - Remove most of the step5 excludes in the Makefile except for ones which don't have TCO capability at all (or the implementation is too slow): bash, make, mal, matlab. - Make perf_EXCLUDES consistent with other excludes. - Add a print-FOO target which prints the resolved value of Makefile variable FOO. For example, `make print-IMPLS` to print the list of implementations. --- Makefile | 45 +++++++++++------------------------ awk/tests/step5_tco.mal | 2 ++ c/tests/step5_tco.mal | 2 ++ clojure/tests/step5_tco.mal | 15 ++++++++++++ coffee/tests/step5_tco.mal | 15 ++++++++++++ cpp/tests/step5_tco.mal | 2 ++ crystal/tests/step5_tco.mal | 2 ++ cs/tests/step5_tco.mal | 2 ++ d/tests/step5_tco.mal | 2 ++ elisp/tests/step5_tco.mal | 15 ++++++++++++ elixir/tests/step5_tco.mal | 2 ++ erlang/tests/step5_tco.mal | 2 ++ es6/tests/step5_tco.mal | 15 ++++++++++++ factor/tests/step5_tco.mal | 15 ++++++++++++ forth/tests/step5_tco.mal | 15 ++++++++++++ fsharp/tests/step5_tco.mal | 2 ++ go/tests/step5_tco.mal | 2 ++ groovy/tests/step5_tco.mal | 15 ++++++++++++ guile/tests/step5_tco.mal | 15 ++++++++++++ haskell/tests/step5_tco.mal | 2 ++ haxe/tests/step5_tco.mal | 15 ++++++++++++ io/tests/step5_tco.mal | 2 ++ java/tests/step5_tco.mal | 15 ++++++++++++ js/tests/step5_tco.mal | 15 ++++++++++++ julia/tests/step5_tco.mal | 15 ++++++++++++ kotlin/tests/step5_tco.mal | 15 ++++++++++++ lua/tests/step5_tco.mal | 15 ++++++++++++ miniMAL/tests/step5_tco.mal | 2 ++ nim/tests/step5_tco.mal | 2 ++ objc/tests/step5_tco.mal | 2 ++ objpascal/tests/step5_tco.mal | 2 ++ ocaml/tests/step5_tco.mal | 2 ++ perl/tests/step5_tco.mal | 15 ++++++++++++ php/tests/step5_tco.mal | 2 ++ ps/tests/step5_tco.mal | 15 ++++++++++++ python/tests/step5_tco.mal | 15 ++++++++++++ r/tests/step5_tco.mal | 15 ++++++++++++ racket/tests/step5_tco.mal | 2 ++ rpython/tests/step5_tco.mal | 15 ++++++++++++ ruby/tests/step5_tco.mal | 15 ++++++++++++ rust/tests/step5_tco.mal | 2 ++ scala/tests/step5_tco.mal | 15 ++++++++++++ swift/tests/step5_tco.mal | 15 ++++++++++++ swift3/tests/step5_tco.mal | 2 ++ tcl/tests/step5_tco.mal | 15 ++++++++++++ tests/step5_tco.mal | 17 ------------- vb/tests/step5_tco.mal | 2 ++ vimscript/tests/step5_tco.mal | 15 ++++++++++++ 48 files changed, 418 insertions(+), 48 deletions(-) create mode 100644 awk/tests/step5_tco.mal create mode 100644 c/tests/step5_tco.mal create mode 100644 clojure/tests/step5_tco.mal create mode 100644 coffee/tests/step5_tco.mal create mode 100644 cpp/tests/step5_tco.mal create mode 100644 crystal/tests/step5_tco.mal create mode 100644 cs/tests/step5_tco.mal create mode 100644 d/tests/step5_tco.mal create mode 100644 elisp/tests/step5_tco.mal create mode 100644 elixir/tests/step5_tco.mal create mode 100644 erlang/tests/step5_tco.mal create mode 100644 es6/tests/step5_tco.mal create mode 100644 factor/tests/step5_tco.mal create mode 100644 forth/tests/step5_tco.mal create mode 100644 fsharp/tests/step5_tco.mal create mode 100644 go/tests/step5_tco.mal create mode 100644 groovy/tests/step5_tco.mal create mode 100644 guile/tests/step5_tco.mal create mode 100644 haskell/tests/step5_tco.mal create mode 100644 haxe/tests/step5_tco.mal create mode 100644 io/tests/step5_tco.mal create mode 100644 java/tests/step5_tco.mal create mode 100644 js/tests/step5_tco.mal create mode 100644 julia/tests/step5_tco.mal create mode 100644 kotlin/tests/step5_tco.mal create mode 100644 lua/tests/step5_tco.mal create mode 100644 miniMAL/tests/step5_tco.mal create mode 100644 nim/tests/step5_tco.mal create mode 100644 objc/tests/step5_tco.mal create mode 100644 objpascal/tests/step5_tco.mal create mode 100644 ocaml/tests/step5_tco.mal create mode 100644 perl/tests/step5_tco.mal create mode 100644 php/tests/step5_tco.mal create mode 100644 ps/tests/step5_tco.mal create mode 100644 python/tests/step5_tco.mal create mode 100644 r/tests/step5_tco.mal create mode 100644 racket/tests/step5_tco.mal create mode 100644 rpython/tests/step5_tco.mal create mode 100644 ruby/tests/step5_tco.mal create mode 100644 rust/tests/step5_tco.mal create mode 100644 scala/tests/step5_tco.mal create mode 100644 swift/tests/step5_tco.mal create mode 100644 swift3/tests/step5_tco.mal create mode 100644 tcl/tests/step5_tco.mal create mode 100644 vb/tests/step5_tco.mal create mode 100644 vimscript/tests/step5_tco.mal diff --git a/Makefile b/Makefile index 82066effe5..b3c169699f 100644 --- a/Makefile +++ b/Makefile @@ -97,35 +97,12 @@ regress_step8 = $(regress_step7) step8 regress_step9 = $(regress_step8) step9 regress_stepA = $(regress_step9) stepA -STEP5_EXCLUDES += awk # completes at 10,000 -STEP5_EXCLUDES += bash # no stack exhaustion or completion -STEP5_EXCLUDES += c # segfault -STEP5_EXCLUDES += cpp # completes at 10,000 -STEP5_EXCLUDES += crystal # test completes, even at 1,000,000 -STEP5_EXCLUDES += cs # fatal stack overflow fault -STEP5_EXCLUDES += d # completes at 10,000, fatal stack overflow at 1,000,000 -STEP5_EXCLUDES += erlang # erlang is TCO, test passes -STEP5_EXCLUDES += elixir # elixir is TCO, test passes -STEP5_EXCLUDES += fsharp # completes at 10,000, fatal stack overflow at 100,000 -STEP5_EXCLUDES += go # test completes, even at 100,000 -STEP5_EXCLUDES += haskell # test completes -STEP5_EXCLUDES += io # too slow to complete 10,000 -STEP5_EXCLUDES += make # no TCO capability/step -STEP5_EXCLUDES += mal # no TCO capability/step -STEP5_EXCLUDES += matlab # too slow to complete 10,000 -STEP5_EXCLUDES += miniMAL # strange error with runtest.py -STEP5_EXCLUDES += nim # test completes, even at 100,000 -STEP5_EXCLUDES += objc # completes at 10,000, crashes at 100,000 -STEP5_EXCLUDES += objpascal # completes at 10,000 -STEP5_EXCLUDES += php # test completes, even at 100,000 -STEP5_EXCLUDES += racket # test completes -STEP5_EXCLUDES += ruby # test completes, even at 100,000 -STEP5_EXCLUDES += rust # no catching stack overflows -STEP5_EXCLUDES += swift3 # no catching stack overflows -STEP5_EXCLUDES += ocaml # test completes, even at 1,000,000 -STEP5_EXCLUDES += vb # completes at 10,000 - -PERF_EXCLUDES = mal # TODO: fix this +test_EXCLUDES += test^bash^step5 # never completes at 10,000 +test_EXCLUDES += test^make^step5 # no TCO capability (iteration or recursion) +test_EXCLUDES += test^mal^step5 # host impl dependent +test_EXCLUDES += test^matlab^step5 # never completes at 10,000 + +perf_EXCLUDES = mal # TODO: fix this dist_EXCLUDES += mal # TODO: still need to implement dist @@ -294,14 +271,14 @@ STEPS = $(sort $(filter step%,$(.VARIABLES))) DO_IMPLS = $(filter-out $(SKIP_IMPLS),$(IMPLS)) IMPL_TESTS = $(foreach impl,$(DO_IMPLS),test^$(impl)) STEP_TESTS = $(foreach step,$(STEPS),test^$(step)) -ALL_TESTS = $(filter-out $(foreach impl,$(STEP5_EXCLUDES),test^$(impl)^step5),\ +ALL_TESTS = $(filter-out $(test_EXCLUDES),\ $(strip $(sort \ $(foreach impl,$(DO_IMPLS),\ $(foreach step,$(STEPS),test^$(impl)^$(step)))))) DOCKER_BUILD = $(foreach impl,$(DO_IMPLS),docker-build^$(impl)) -IMPL_PERF = $(foreach impl,$(filter-out $(PERF_EXCLUDES),$(DO_IMPLS)),perf^$(impl)) +IMPL_PERF = $(foreach impl,$(filter-out $(perf_EXCLUDES),$(DO_IMPLS)),perf^$(impl)) IMPL_REPL = $(foreach impl,$(DO_IMPLS),repl^$(impl)) ALL_REPL = $(strip $(sort \ @@ -421,6 +398,12 @@ $(ALL_REPL): $$(call $$(word 2,$$(subst ^, ,$$(@)))_STEP_TO_PROG,$$(word 3,$$(su .SECONDEXPANSION: $(IMPL_REPL): $$@^stepA +# +# Utility functions +# +.SECONDEXPANSION: +print-%: + @echo "$($(*))" # # Recursive rules (call make FOO in each subdirectory) diff --git a/awk/tests/step5_tco.mal b/awk/tests/step5_tco.mal new file mode 100644 index 0000000000..b0bfbe0470 --- /dev/null +++ b/awk/tests/step5_tco.mal @@ -0,0 +1,2 @@ +;; awk: skipping non-TCO recursion +;; Reason: completes up to 50,000 diff --git a/c/tests/step5_tco.mal b/c/tests/step5_tco.mal new file mode 100644 index 0000000000..be6a117a62 --- /dev/null +++ b/c/tests/step5_tco.mal @@ -0,0 +1,2 @@ +;; C: skipping non-TCO recursion +;; Reason: segfaults (unrecoverable) diff --git a/clojure/tests/step5_tco.mal b/clojure/tests/step5_tco.mal new file mode 100644 index 0000000000..d20df25db7 --- /dev/null +++ b/clojure/tests/step5_tco.mal @@ -0,0 +1,15 @@ +;; Test recursive non-tail call function + +(def! sum-to (fn* (n) (if (= n 0) 0 (+ n (sum-to (- n 1)))))) + +(sum-to 10) +;=>55 + +;;; no try* yet, so test completion of side-effects +(def! res1 nil) +;=>nil +;;; For implementations without their own TCO this should fail and +;;; leave res1 unchanged +(def! res1 (sum-to 10000)) +res1 +;=>nil diff --git a/coffee/tests/step5_tco.mal b/coffee/tests/step5_tco.mal new file mode 100644 index 0000000000..d20df25db7 --- /dev/null +++ b/coffee/tests/step5_tco.mal @@ -0,0 +1,15 @@ +;; Test recursive non-tail call function + +(def! sum-to (fn* (n) (if (= n 0) 0 (+ n (sum-to (- n 1)))))) + +(sum-to 10) +;=>55 + +;;; no try* yet, so test completion of side-effects +(def! res1 nil) +;=>nil +;;; For implementations without their own TCO this should fail and +;;; leave res1 unchanged +(def! res1 (sum-to 10000)) +res1 +;=>nil diff --git a/cpp/tests/step5_tco.mal b/cpp/tests/step5_tco.mal new file mode 100644 index 0000000000..f48fa336da --- /dev/null +++ b/cpp/tests/step5_tco.mal @@ -0,0 +1,2 @@ +;; C++: skipping non-TCO recursion +;; Reason: completes at 10,000, segfaults at 20,000 diff --git a/crystal/tests/step5_tco.mal b/crystal/tests/step5_tco.mal new file mode 100644 index 0000000000..1fd025b6a0 --- /dev/null +++ b/crystal/tests/step5_tco.mal @@ -0,0 +1,2 @@ +;; Crystal: skipping non-TCO recursion +;; Reason: completes at 1,000,000 diff --git a/cs/tests/step5_tco.mal b/cs/tests/step5_tco.mal new file mode 100644 index 0000000000..4fec62e2fc --- /dev/null +++ b/cs/tests/step5_tco.mal @@ -0,0 +1,2 @@ +;; C#: skipping non-TCO recursion +;; Reason: unrecoverable stack overflow at 10,000 diff --git a/d/tests/step5_tco.mal b/d/tests/step5_tco.mal new file mode 100644 index 0000000000..de8bbcb6b9 --- /dev/null +++ b/d/tests/step5_tco.mal @@ -0,0 +1,2 @@ +;; D: skipping non-TCO recursion +;; Reason: completes at 10,000, segfaults at 40,000 diff --git a/elisp/tests/step5_tco.mal b/elisp/tests/step5_tco.mal new file mode 100644 index 0000000000..d20df25db7 --- /dev/null +++ b/elisp/tests/step5_tco.mal @@ -0,0 +1,15 @@ +;; Test recursive non-tail call function + +(def! sum-to (fn* (n) (if (= n 0) 0 (+ n (sum-to (- n 1)))))) + +(sum-to 10) +;=>55 + +;;; no try* yet, so test completion of side-effects +(def! res1 nil) +;=>nil +;;; For implementations without their own TCO this should fail and +;;; leave res1 unchanged +(def! res1 (sum-to 10000)) +res1 +;=>nil diff --git a/elixir/tests/step5_tco.mal b/elixir/tests/step5_tco.mal new file mode 100644 index 0000000000..6b1ba58860 --- /dev/null +++ b/elixir/tests/step5_tco.mal @@ -0,0 +1,2 @@ +;; Elixir: skipping non-TCO recursion +;; Reason: Elixir has TCO, test always completes. diff --git a/erlang/tests/step5_tco.mal b/erlang/tests/step5_tco.mal new file mode 100644 index 0000000000..54b616b446 --- /dev/null +++ b/erlang/tests/step5_tco.mal @@ -0,0 +1,2 @@ +;; Erlang: skipping non-TCO recursion +;; Reason: Erlang has TCO, test always completes. diff --git a/es6/tests/step5_tco.mal b/es6/tests/step5_tco.mal new file mode 100644 index 0000000000..d20df25db7 --- /dev/null +++ b/es6/tests/step5_tco.mal @@ -0,0 +1,15 @@ +;; Test recursive non-tail call function + +(def! sum-to (fn* (n) (if (= n 0) 0 (+ n (sum-to (- n 1)))))) + +(sum-to 10) +;=>55 + +;;; no try* yet, so test completion of side-effects +(def! res1 nil) +;=>nil +;;; For implementations without their own TCO this should fail and +;;; leave res1 unchanged +(def! res1 (sum-to 10000)) +res1 +;=>nil diff --git a/factor/tests/step5_tco.mal b/factor/tests/step5_tco.mal new file mode 100644 index 0000000000..d20df25db7 --- /dev/null +++ b/factor/tests/step5_tco.mal @@ -0,0 +1,15 @@ +;; Test recursive non-tail call function + +(def! sum-to (fn* (n) (if (= n 0) 0 (+ n (sum-to (- n 1)))))) + +(sum-to 10) +;=>55 + +;;; no try* yet, so test completion of side-effects +(def! res1 nil) +;=>nil +;;; For implementations without their own TCO this should fail and +;;; leave res1 unchanged +(def! res1 (sum-to 10000)) +res1 +;=>nil diff --git a/forth/tests/step5_tco.mal b/forth/tests/step5_tco.mal new file mode 100644 index 0000000000..d20df25db7 --- /dev/null +++ b/forth/tests/step5_tco.mal @@ -0,0 +1,15 @@ +;; Test recursive non-tail call function + +(def! sum-to (fn* (n) (if (= n 0) 0 (+ n (sum-to (- n 1)))))) + +(sum-to 10) +;=>55 + +;;; no try* yet, so test completion of side-effects +(def! res1 nil) +;=>nil +;;; For implementations without their own TCO this should fail and +;;; leave res1 unchanged +(def! res1 (sum-to 10000)) +res1 +;=>nil diff --git a/fsharp/tests/step5_tco.mal b/fsharp/tests/step5_tco.mal new file mode 100644 index 0000000000..db45a80336 --- /dev/null +++ b/fsharp/tests/step5_tco.mal @@ -0,0 +1,2 @@ +;; F#: skipping non-TCO recursion +;; Reason: completes at 10,000, unrecoverable segfault at 20,000 diff --git a/go/tests/step5_tco.mal b/go/tests/step5_tco.mal new file mode 100644 index 0000000000..6fa1da6fdf --- /dev/null +++ b/go/tests/step5_tco.mal @@ -0,0 +1,2 @@ +;; Go: skipping non-TCO recursion +;; Reason: completes even at 100,000 diff --git a/groovy/tests/step5_tco.mal b/groovy/tests/step5_tco.mal new file mode 100644 index 0000000000..d20df25db7 --- /dev/null +++ b/groovy/tests/step5_tco.mal @@ -0,0 +1,15 @@ +;; Test recursive non-tail call function + +(def! sum-to (fn* (n) (if (= n 0) 0 (+ n (sum-to (- n 1)))))) + +(sum-to 10) +;=>55 + +;;; no try* yet, so test completion of side-effects +(def! res1 nil) +;=>nil +;;; For implementations without their own TCO this should fail and +;;; leave res1 unchanged +(def! res1 (sum-to 10000)) +res1 +;=>nil diff --git a/guile/tests/step5_tco.mal b/guile/tests/step5_tco.mal new file mode 100644 index 0000000000..d20df25db7 --- /dev/null +++ b/guile/tests/step5_tco.mal @@ -0,0 +1,15 @@ +;; Test recursive non-tail call function + +(def! sum-to (fn* (n) (if (= n 0) 0 (+ n (sum-to (- n 1)))))) + +(sum-to 10) +;=>55 + +;;; no try* yet, so test completion of side-effects +(def! res1 nil) +;=>nil +;;; For implementations without their own TCO this should fail and +;;; leave res1 unchanged +(def! res1 (sum-to 10000)) +res1 +;=>nil diff --git a/haskell/tests/step5_tco.mal b/haskell/tests/step5_tco.mal new file mode 100644 index 0000000000..eb5ace7418 --- /dev/null +++ b/haskell/tests/step5_tco.mal @@ -0,0 +1,2 @@ +;; Haskell: skipping non-TCO recursion +;; Reason: completes up to 100,000, stackoverflow at 1,000,000 diff --git a/haxe/tests/step5_tco.mal b/haxe/tests/step5_tco.mal new file mode 100644 index 0000000000..d20df25db7 --- /dev/null +++ b/haxe/tests/step5_tco.mal @@ -0,0 +1,15 @@ +;; Test recursive non-tail call function + +(def! sum-to (fn* (n) (if (= n 0) 0 (+ n (sum-to (- n 1)))))) + +(sum-to 10) +;=>55 + +;;; no try* yet, so test completion of side-effects +(def! res1 nil) +;=>nil +;;; For implementations without their own TCO this should fail and +;;; leave res1 unchanged +(def! res1 (sum-to 10000)) +res1 +;=>nil diff --git a/io/tests/step5_tco.mal b/io/tests/step5_tco.mal new file mode 100644 index 0000000000..58142ab23c --- /dev/null +++ b/io/tests/step5_tco.mal @@ -0,0 +1,2 @@ +;; Io: skipping non-TCO recursion +;; Reason: never completes, never segfaults diff --git a/java/tests/step5_tco.mal b/java/tests/step5_tco.mal new file mode 100644 index 0000000000..d20df25db7 --- /dev/null +++ b/java/tests/step5_tco.mal @@ -0,0 +1,15 @@ +;; Test recursive non-tail call function + +(def! sum-to (fn* (n) (if (= n 0) 0 (+ n (sum-to (- n 1)))))) + +(sum-to 10) +;=>55 + +;;; no try* yet, so test completion of side-effects +(def! res1 nil) +;=>nil +;;; For implementations without their own TCO this should fail and +;;; leave res1 unchanged +(def! res1 (sum-to 10000)) +res1 +;=>nil diff --git a/js/tests/step5_tco.mal b/js/tests/step5_tco.mal new file mode 100644 index 0000000000..d20df25db7 --- /dev/null +++ b/js/tests/step5_tco.mal @@ -0,0 +1,15 @@ +;; Test recursive non-tail call function + +(def! sum-to (fn* (n) (if (= n 0) 0 (+ n (sum-to (- n 1)))))) + +(sum-to 10) +;=>55 + +;;; no try* yet, so test completion of side-effects +(def! res1 nil) +;=>nil +;;; For implementations without their own TCO this should fail and +;;; leave res1 unchanged +(def! res1 (sum-to 10000)) +res1 +;=>nil diff --git a/julia/tests/step5_tco.mal b/julia/tests/step5_tco.mal new file mode 100644 index 0000000000..d20df25db7 --- /dev/null +++ b/julia/tests/step5_tco.mal @@ -0,0 +1,15 @@ +;; Test recursive non-tail call function + +(def! sum-to (fn* (n) (if (= n 0) 0 (+ n (sum-to (- n 1)))))) + +(sum-to 10) +;=>55 + +;;; no try* yet, so test completion of side-effects +(def! res1 nil) +;=>nil +;;; For implementations without their own TCO this should fail and +;;; leave res1 unchanged +(def! res1 (sum-to 10000)) +res1 +;=>nil diff --git a/kotlin/tests/step5_tco.mal b/kotlin/tests/step5_tco.mal new file mode 100644 index 0000000000..d20df25db7 --- /dev/null +++ b/kotlin/tests/step5_tco.mal @@ -0,0 +1,15 @@ +;; Test recursive non-tail call function + +(def! sum-to (fn* (n) (if (= n 0) 0 (+ n (sum-to (- n 1)))))) + +(sum-to 10) +;=>55 + +;;; no try* yet, so test completion of side-effects +(def! res1 nil) +;=>nil +;;; For implementations without their own TCO this should fail and +;;; leave res1 unchanged +(def! res1 (sum-to 10000)) +res1 +;=>nil diff --git a/lua/tests/step5_tco.mal b/lua/tests/step5_tco.mal new file mode 100644 index 0000000000..d20df25db7 --- /dev/null +++ b/lua/tests/step5_tco.mal @@ -0,0 +1,15 @@ +;; Test recursive non-tail call function + +(def! sum-to (fn* (n) (if (= n 0) 0 (+ n (sum-to (- n 1)))))) + +(sum-to 10) +;=>55 + +;;; no try* yet, so test completion of side-effects +(def! res1 nil) +;=>nil +;;; For implementations without their own TCO this should fail and +;;; leave res1 unchanged +(def! res1 (sum-to 10000)) +res1 +;=>nil diff --git a/miniMAL/tests/step5_tco.mal b/miniMAL/tests/step5_tco.mal new file mode 100644 index 0000000000..c5ab084ce6 --- /dev/null +++ b/miniMAL/tests/step5_tco.mal @@ -0,0 +1,2 @@ +;; miniMAL skipping non-TCO recursion +;; Reason: Unrecoverable stack overflow at 10,000 diff --git a/nim/tests/step5_tco.mal b/nim/tests/step5_tco.mal new file mode 100644 index 0000000000..522de3e30e --- /dev/null +++ b/nim/tests/step5_tco.mal @@ -0,0 +1,2 @@ +;; Nim: skipping non-TCO recursion +;; Reason: completes at 10,000, unrecoverable segfault 20,000 diff --git a/objc/tests/step5_tco.mal b/objc/tests/step5_tco.mal new file mode 100644 index 0000000000..0a7e00560c --- /dev/null +++ b/objc/tests/step5_tco.mal @@ -0,0 +1,2 @@ +;; Objective C: skipping non-TCO recursion +;; Reason: completes at 10,000, unrecoverable segfault at 20,000 diff --git a/objpascal/tests/step5_tco.mal b/objpascal/tests/step5_tco.mal new file mode 100644 index 0000000000..9a24ee4d02 --- /dev/null +++ b/objpascal/tests/step5_tco.mal @@ -0,0 +1,2 @@ +;; Object Pascal: skipping non-TCO recursion +;; Reason: completes at 10,000, unrecoverable segfault at 20,000 diff --git a/ocaml/tests/step5_tco.mal b/ocaml/tests/step5_tco.mal new file mode 100644 index 0000000000..193f7b66fd --- /dev/null +++ b/ocaml/tests/step5_tco.mal @@ -0,0 +1,2 @@ +;; Ocaml skipping non-TCO recursion +;; Reason: completes at 50,000, unrecoverable segfaul at 100,000 diff --git a/perl/tests/step5_tco.mal b/perl/tests/step5_tco.mal new file mode 100644 index 0000000000..d20df25db7 --- /dev/null +++ b/perl/tests/step5_tco.mal @@ -0,0 +1,15 @@ +;; Test recursive non-tail call function + +(def! sum-to (fn* (n) (if (= n 0) 0 (+ n (sum-to (- n 1)))))) + +(sum-to 10) +;=>55 + +;;; no try* yet, so test completion of side-effects +(def! res1 nil) +;=>nil +;;; For implementations without their own TCO this should fail and +;;; leave res1 unchanged +(def! res1 (sum-to 10000)) +res1 +;=>nil diff --git a/php/tests/step5_tco.mal b/php/tests/step5_tco.mal new file mode 100644 index 0000000000..d04796d469 --- /dev/null +++ b/php/tests/step5_tco.mal @@ -0,0 +1,2 @@ +;; PHP: skipping non-TCO recursion +;; Reason: completes at 10,000, unrecoverable segfault at 20,000 diff --git a/ps/tests/step5_tco.mal b/ps/tests/step5_tco.mal new file mode 100644 index 0000000000..d20df25db7 --- /dev/null +++ b/ps/tests/step5_tco.mal @@ -0,0 +1,15 @@ +;; Test recursive non-tail call function + +(def! sum-to (fn* (n) (if (= n 0) 0 (+ n (sum-to (- n 1)))))) + +(sum-to 10) +;=>55 + +;;; no try* yet, so test completion of side-effects +(def! res1 nil) +;=>nil +;;; For implementations without their own TCO this should fail and +;;; leave res1 unchanged +(def! res1 (sum-to 10000)) +res1 +;=>nil diff --git a/python/tests/step5_tco.mal b/python/tests/step5_tco.mal new file mode 100644 index 0000000000..d20df25db7 --- /dev/null +++ b/python/tests/step5_tco.mal @@ -0,0 +1,15 @@ +;; Test recursive non-tail call function + +(def! sum-to (fn* (n) (if (= n 0) 0 (+ n (sum-to (- n 1)))))) + +(sum-to 10) +;=>55 + +;;; no try* yet, so test completion of side-effects +(def! res1 nil) +;=>nil +;;; For implementations without their own TCO this should fail and +;;; leave res1 unchanged +(def! res1 (sum-to 10000)) +res1 +;=>nil diff --git a/r/tests/step5_tco.mal b/r/tests/step5_tco.mal new file mode 100644 index 0000000000..d20df25db7 --- /dev/null +++ b/r/tests/step5_tco.mal @@ -0,0 +1,15 @@ +;; Test recursive non-tail call function + +(def! sum-to (fn* (n) (if (= n 0) 0 (+ n (sum-to (- n 1)))))) + +(sum-to 10) +;=>55 + +;;; no try* yet, so test completion of side-effects +(def! res1 nil) +;=>nil +;;; For implementations without their own TCO this should fail and +;;; leave res1 unchanged +(def! res1 (sum-to 10000)) +res1 +;=>nil diff --git a/racket/tests/step5_tco.mal b/racket/tests/step5_tco.mal new file mode 100644 index 0000000000..93286cd766 --- /dev/null +++ b/racket/tests/step5_tco.mal @@ -0,0 +1,2 @@ +;; Racket: skipping non-TCO recursion +;; Reason: completes up to 1,000,000 diff --git a/rpython/tests/step5_tco.mal b/rpython/tests/step5_tco.mal new file mode 100644 index 0000000000..d20df25db7 --- /dev/null +++ b/rpython/tests/step5_tco.mal @@ -0,0 +1,15 @@ +;; Test recursive non-tail call function + +(def! sum-to (fn* (n) (if (= n 0) 0 (+ n (sum-to (- n 1)))))) + +(sum-to 10) +;=>55 + +;;; no try* yet, so test completion of side-effects +(def! res1 nil) +;=>nil +;;; For implementations without their own TCO this should fail and +;;; leave res1 unchanged +(def! res1 (sum-to 10000)) +res1 +;=>nil diff --git a/ruby/tests/step5_tco.mal b/ruby/tests/step5_tco.mal new file mode 100644 index 0000000000..d20df25db7 --- /dev/null +++ b/ruby/tests/step5_tco.mal @@ -0,0 +1,15 @@ +;; Test recursive non-tail call function + +(def! sum-to (fn* (n) (if (= n 0) 0 (+ n (sum-to (- n 1)))))) + +(sum-to 10) +;=>55 + +;;; no try* yet, so test completion of side-effects +(def! res1 nil) +;=>nil +;;; For implementations without their own TCO this should fail and +;;; leave res1 unchanged +(def! res1 (sum-to 10000)) +res1 +;=>nil diff --git a/rust/tests/step5_tco.mal b/rust/tests/step5_tco.mal new file mode 100644 index 0000000000..5cf775f657 --- /dev/null +++ b/rust/tests/step5_tco.mal @@ -0,0 +1,2 @@ +;; Rust: skipping non-TCO recursion +;; Reason: unrecoverable stack overflow diff --git a/scala/tests/step5_tco.mal b/scala/tests/step5_tco.mal new file mode 100644 index 0000000000..d20df25db7 --- /dev/null +++ b/scala/tests/step5_tco.mal @@ -0,0 +1,15 @@ +;; Test recursive non-tail call function + +(def! sum-to (fn* (n) (if (= n 0) 0 (+ n (sum-to (- n 1)))))) + +(sum-to 10) +;=>55 + +;;; no try* yet, so test completion of side-effects +(def! res1 nil) +;=>nil +;;; For implementations without their own TCO this should fail and +;;; leave res1 unchanged +(def! res1 (sum-to 10000)) +res1 +;=>nil diff --git a/swift/tests/step5_tco.mal b/swift/tests/step5_tco.mal new file mode 100644 index 0000000000..d20df25db7 --- /dev/null +++ b/swift/tests/step5_tco.mal @@ -0,0 +1,15 @@ +;; Test recursive non-tail call function + +(def! sum-to (fn* (n) (if (= n 0) 0 (+ n (sum-to (- n 1)))))) + +(sum-to 10) +;=>55 + +;;; no try* yet, so test completion of side-effects +(def! res1 nil) +;=>nil +;;; For implementations without their own TCO this should fail and +;;; leave res1 unchanged +(def! res1 (sum-to 10000)) +res1 +;=>nil diff --git a/swift3/tests/step5_tco.mal b/swift3/tests/step5_tco.mal new file mode 100644 index 0000000000..3a866dc556 --- /dev/null +++ b/swift3/tests/step5_tco.mal @@ -0,0 +1,2 @@ +;; Swift 3: skipping non-TCO recursion +;; Reason: unrecoverable segfault at 10,000 diff --git a/tcl/tests/step5_tco.mal b/tcl/tests/step5_tco.mal new file mode 100644 index 0000000000..d20df25db7 --- /dev/null +++ b/tcl/tests/step5_tco.mal @@ -0,0 +1,15 @@ +;; Test recursive non-tail call function + +(def! sum-to (fn* (n) (if (= n 0) 0 (+ n (sum-to (- n 1)))))) + +(sum-to 10) +;=>55 + +;;; no try* yet, so test completion of side-effects +(def! res1 nil) +;=>nil +;;; For implementations without their own TCO this should fail and +;;; leave res1 unchanged +(def! res1 (sum-to 10000)) +res1 +;=>nil diff --git a/tests/step5_tco.mal b/tests/step5_tco.mal index d2e83b9031..42c7fa421a 100644 --- a/tests/step5_tco.mal +++ b/tests/step5_tco.mal @@ -19,20 +19,3 @@ res2 (foo 10000) ;=>0 - - -;; Test recursive non-tail call function - -(def! sum-to (fn* (n) (if (= n 0) 0 (+ n (sum-to (- n 1)))))) - -(sum-to 10) -;=>55 - -;;; no try* yet, so test completion of side-effects -(def! res1 nil) -;=>nil -;;; For implementations without their own TCO this should fail and -;;; leave res1 unchanged -(def! res1 (sum-to 10000)) -res1 -;=>nil diff --git a/vb/tests/step5_tco.mal b/vb/tests/step5_tco.mal new file mode 100644 index 0000000000..3631fdf53f --- /dev/null +++ b/vb/tests/step5_tco.mal @@ -0,0 +1,2 @@ +;; VB: skipping non-TCO recursion +;; Reason: unrecoverable segfault at 10,000 diff --git a/vimscript/tests/step5_tco.mal b/vimscript/tests/step5_tco.mal new file mode 100644 index 0000000000..d20df25db7 --- /dev/null +++ b/vimscript/tests/step5_tco.mal @@ -0,0 +1,15 @@ +;; Test recursive non-tail call function + +(def! sum-to (fn* (n) (if (= n 0) 0 (+ n (sum-to (- n 1)))))) + +(sum-to 10) +;=>55 + +;;; no try* yet, so test completion of side-effects +(def! res1 nil) +;=>nil +;;; For implementations without their own TCO this should fail and +;;; leave res1 unchanged +(def! res1 (sum-to 10000)) +res1 +;=>nil