Skip to content

Commit

Permalink
Merge pull request #41 from NobbZ/master
Browse files Browse the repository at this point in the history
[sum-of-multiples] update tests to match common test data
  • Loading branch information
yurrriq authored Aug 14, 2016
2 parents 40a502e + 833f852 commit 416199b
Show file tree
Hide file tree
Showing 2 changed files with 25 additions and 13 deletions.
5 changes: 1 addition & 4 deletions exercises/sum-of-multiples/src/example.lfe
Original file line number Diff line number Diff line change
@@ -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
Expand Down
33 changes: 24 additions & 9 deletions exercises/sum-of-multiples/test/sum-of-multiples-tests.lfe
Original file line number Diff line number Diff line change
Expand Up @@ -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)))

0 comments on commit 416199b

Please sign in to comment.