Mercurial > lasercutter
view 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 |
line wrap: on
line source
1 ; Copyright (c) Rich Hickey. All rights reserved.2 ; The use and distribution terms for this software are covered by the3 ; 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 by6 ; the terms of this license.7 ; You must not remove this notice, or any other, from this software.9 ; Author: Frantisek Sodomka, Stephen C. Gilardi12 (ns clojure.test-clojure.vars13 (:use clojure.test))15 ; http://clojure.org/vars17 ; def18 ; defn defn- defonce20 ; declare intern binding find-var var22 (def a)23 (deftest test-binding24 (are [x y] (= x y)25 (eval `(binding [a 4] a)) 4 ; regression in Clojure SVN r137026 ))28 ; with-local-vars var-get var-set alter-var-root [var? (predicates.clj)]29 ; with-in-str with-out-str30 ; with-open31 ; with-precision33 (deftest test-with-precision34 (are [x y] (= x y)35 (with-precision 4 (+ 3.5555555M 1)) 4.556M36 (with-precision 6 (+ 3.5555555M 1)) 4.55556M37 (with-precision 6 :rounding CEILING (+ 3.5555555M 1)) 4.55556M38 (with-precision 6 :rounding FLOOR (+ 3.5555555M 1)) 4.55555M39 (with-precision 6 :rounding HALF_UP (+ 3.5555555M 1)) 4.55556M40 (with-precision 6 :rounding HALF_DOWN (+ 3.5555555M 1)) 4.55556M41 (with-precision 6 :rounding HALF_EVEN (+ 3.5555555M 1)) 4.55556M42 (with-precision 6 :rounding UP (+ 3.5555555M 1)) 4.55556M43 (with-precision 6 :rounding DOWN (+ 3.5555555M 1)) 4.55555M44 (with-precision 6 :rounding UNNECESSARY (+ 3.5555M 1)) 4.5555M))46 (deftest test-settable-math-context47 (is (=48 (clojure.main/with-bindings49 (set! *math-context* (java.math.MathContext. 8))50 (+ 3.55555555555555M 1))51 4.5555556M)))53 ; set-validator get-validator55 ; doc find-doc test