Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[sum-of-multiples] update tests to match common test data #41

Merged
merged 2 commits into from
Aug 14, 2016
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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)))