From 50998aaa7f51bcac8ce09e1b83a254c306e123dd Mon Sep 17 00:00:00 2001 From: Norbert Melzer Date: Sun, 14 Aug 2016 09:37:59 +0200 Subject: [PATCH 1/2] [sum-of-multiples] adjust testsuite to match common-testdata This exercise has got common testdata quite a while ago. This commit implements that common testdata in the most recent version. It does not use a generator though. --- .../test/sum-of-multiples-tests.lfe | 33 ++++++++++++++----- 1 file changed, 24 insertions(+), 9 deletions(-) diff --git a/exercises/sum-of-multiples/test/sum-of-multiples-tests.lfe b/exercises/sum-of-multiples/test/sum-of-multiples-tests.lfe index 44b9974..f1cfb03 100644 --- a/exercises/sum-of-multiples/test/sum-of-multiples-tests.lfe +++ b/exercises/sum-of-multiples/test/sum-of-multiples-tests.lfe @@ -5,22 +5,37 @@ (include-lib "ltest/include/ltest-macros.lfe") (deftest sum-to-1 - (is-equal 0 (sum-of-multiples:sum-of-multiples 1))) + (is-equal 0 (sum-of-multiples:sum-of-multiples '(3 5) 1))) -(deftest sum-to-3 - (is-equal 3 (sum-of-multiples:sum-of-multiples 4))) +(deftest sum-to-4 + (is-equal 3 (sum-of-multiples:sum-of-multiples '(3 5) 4))) (deftest sum-to-10 - (is-equal 23 (sum-of-multiples:sum-of-multiples 10))) + (is-equal 23 (sum-of-multiples:sum-of-multiples '(3 5) 10))) (deftest sum-to-100 - (is-equal 2318 (sum-of-multiples:sum-of-multiples 100))) - + (is-equal 2318 (sum-of-multiples:sum-of-multiples '(3 5) 100))) + (deftest sum-to-1000 - (is-equal 233168 (sum-of-multiples:sum-of-multiples 1000))) + (is-equal 233168 (sum-of-multiples:sum-of-multiples '(3 5) 1000))) -(deftest sum-of-configurable-to-20 +(deftest sum-to-20-using-7-13-17 (is-equal 51 (sum-of-multiples:sum-of-multiples '(7 13 17) 20))) -(deftest sum-of-configurable-to-10000 +(deftest sum-to-15-using-4-6 + (is-equal 30 (sum-of-multiples:sum-of-multiples '(4 6) 15))) + +(deftest sum-to-150-using-5-6-8 + (is-equal 4419 (sum-of-multiples:sum-of-multiples '(5 6 8) 150))) + +(deftest sum-to-51-using-5-25 + (is-equal 275 (sum-of-multiples:sum-of-multiples '(5 25) 51))) + +(deftest sum-to-10_000-using-43-47 (is-equal 2203160 (sum-of-multiples:sum-of-multiples '(43 47) 10000))) + +(deftest sum-to-100-using-1 + (is-equal 4950 (sum-of-multiples:sum-of-multiples '(1) 100))) + +(deftest sum-to-10_000-using-empty + (is-equal 0 (sum-of-multiples:sum-of-multiples '() 10000))) From 833f8527c5c3d4b7c162743101e6ff9989e5933c Mon Sep 17 00:00:00 2001 From: Norbert Melzer Date: Sun, 14 Aug 2016 09:39:17 +0200 Subject: [PATCH 2/2] [sum-of-multiples] remove unused code in example Due to the changes in the test suite, there was an unused function left in the examples, which gets removed by this commit. --- exercises/sum-of-multiples/src/example.lfe | 5 +---- 1 file changed, 1 insertion(+), 4 deletions(-) diff --git a/exercises/sum-of-multiples/src/example.lfe b/exercises/sum-of-multiples/src/example.lfe index 21a3bda..b45f434 100644 --- a/exercises/sum-of-multiples/src/example.lfe +++ b/exercises/sum-of-multiples/src/example.lfe @@ -1,8 +1,5 @@ (defmodule sum-of-multiples - (export (sum-of-multiples 1) - (sum-of-multiples 2))) - -(defun sum-of-multiples (n) (sum-of-multiples '(3 5) n)) + (export (sum-of-multiples 2))) (defun sum-of-multiples (multiples n) (lists:foldl