Mercurial > lasercutter
comparison src/clojure/test_clojure/vars.clj @ 10:ef7dbbd6452c
added clojure source goodness
author | Robert McIntyre <rlm@mit.edu> |
---|---|
date | Sat, 21 Aug 2010 06:25:44 -0400 |
parents | |
children |
comparison
equal
deleted
inserted
replaced
9:35cf337adfcf | 10:ef7dbbd6452c |
---|---|
1 ; Copyright (c) Rich Hickey. All rights reserved. | |
2 ; The use and distribution terms for this software are covered by the | |
3 ; Eclipse Public License 1.0 (http://opensource.org/licenses/eclipse-1.0.php) | |
4 ; which can be found in the file epl-v10.html at the root of this distribution. | |
5 ; By using this software in any fashion, you are agreeing to be bound by | |
6 ; the terms of this license. | |
7 ; You must not remove this notice, or any other, from this software. | |
8 | |
9 ; Author: Frantisek Sodomka, Stephen C. Gilardi | |
10 | |
11 | |
12 (ns clojure.test-clojure.vars | |
13 (:use clojure.test)) | |
14 | |
15 ; http://clojure.org/vars | |
16 | |
17 ; def | |
18 ; defn defn- defonce | |
19 | |
20 ; declare intern binding find-var var | |
21 | |
22 (def a) | |
23 (deftest test-binding | |
24 (are [x y] (= x y) | |
25 (eval `(binding [a 4] a)) 4 ; regression in Clojure SVN r1370 | |
26 )) | |
27 | |
28 ; with-local-vars var-get var-set alter-var-root [var? (predicates.clj)] | |
29 ; with-in-str with-out-str | |
30 ; with-open | |
31 ; with-precision | |
32 | |
33 (deftest test-with-precision | |
34 (are [x y] (= x y) | |
35 (with-precision 4 (+ 3.5555555M 1)) 4.556M | |
36 (with-precision 6 (+ 3.5555555M 1)) 4.55556M | |
37 (with-precision 6 :rounding CEILING (+ 3.5555555M 1)) 4.55556M | |
38 (with-precision 6 :rounding FLOOR (+ 3.5555555M 1)) 4.55555M | |
39 (with-precision 6 :rounding HALF_UP (+ 3.5555555M 1)) 4.55556M | |
40 (with-precision 6 :rounding HALF_DOWN (+ 3.5555555M 1)) 4.55556M | |
41 (with-precision 6 :rounding HALF_EVEN (+ 3.5555555M 1)) 4.55556M | |
42 (with-precision 6 :rounding UP (+ 3.5555555M 1)) 4.55556M | |
43 (with-precision 6 :rounding DOWN (+ 3.5555555M 1)) 4.55555M | |
44 (with-precision 6 :rounding UNNECESSARY (+ 3.5555M 1)) 4.5555M)) | |
45 | |
46 (deftest test-settable-math-context | |
47 (is (= | |
48 (clojure.main/with-bindings | |
49 (set! *math-context* (java.math.MathContext. 8)) | |
50 (+ 3.55555555555555M 1)) | |
51 4.5555556M))) | |
52 | |
53 ; set-validator get-validator | |
54 | |
55 ; doc find-doc test | |
56 |