Just one thing to note, the metadata “:test” syntax has the same functionality as the “(with-test …)” syntax.
; Site - http://projecteuler.net/problem=1
(ns euler
(:use clojure.test clojure.contrib.math))
(defn
^{:test #(is (= 23 (problem-1 10)))}
problem-1
[max]
(reduce
+
(filter
#(or
(= 0 (mod % 3))
(= 0 (mod % 5)))
(range 1 max))))
First, test the function against the known answer of 23 for an input of 10.
(run-tests)
Testing euler
Ran 1 tests containing 1 assertions.
0 failures, 0 errors.
{:type :summary, :test 1, :pass 1, :fail 0, :error 0}
We have lift off! Now, for the answer to the an input of 1000.