Browse files

Reorganise test scripts

  • Loading branch information...
1 parent 0586bd5 commit 1aec66fd69f1b160e18c292cd9f616afae61e680 @palfrey committed Apr 29, 2012
View
0 test/dxf/test/drawing.py → test/dxf/scripts/drawing.py
File renamed without changes.
View
0 test/dxf/test/face.py → test/dxf/scripts/face.py
File renamed without changes.
View
0 test/dxf/test/sdxf.py → test/dxf/scripts/sdxf.py
File renamed without changes.
View
30 test/dxf/test/core.clj → test/dxf/test.clj
@@ -1,15 +1,20 @@
-(ns dxf.test.core
+(ns dxf.test
(:use [dxf])
(:use [clojure.test])
(:use [clojure.java.shell])
)
(defn exec-python [path]
- (let [s (sh "python"
- (str "/home/palfrey/src/clojure-dxf/test/dxf/test/" path)
- )]
- (if (= (:exit s) 0) (:out s) (throw (Exception. (str "error while running " path))))
- ))
+ (let [
+ fp (str (System/getProperty "user.dir") "/test/dxf/scripts/" path)
+ s (sh "python" fp)
+ ]
+ (if
+ (= (:exit s) 0)
+ (:out s)
+ (throw (Exception. (str "error while running " fp)))
+ )
+ ))
(defn tmpfile [suff]
(doto (java.io.File/createTempFile "dxf" suff) .deleteOnExit))
@@ -23,18 +28,21 @@
(defn diffstrings [a b]
(let [s (sh "diff" "-u" (write-to-temp a) (write-to-temp b))]
- (print (:out s))
- (= (:exit s) 0)))
+ (print (:out s))
+ (= (:exit s) 0))
+ )
(defn cmptext [a b]
(if (= a b) true (diffstrings a b)))
(defn cmpDxf [newObj old]
- (cmptext (generate newObj) (exec-python old)))
+ (cmptext (generate newObj) (exec-python old)))
(deftest drawing
- (is (cmpDxf (Drawing) "drawing.py")))
+ (is (cmpDxf (Drawing) "drawing.py")))
(deftest face
- (let [f (assoc (assoc (Face) :points [[0,0,0],[1,0,0],[1,1,0],[0,1,0]]) :color 4)]
+ (let [
+ f (assoc (assoc (Face) :points [[0,0,0],[1,0,0],[1,1,0],[0,1,0]]) :color 4)
+ ]
(is (cmpDxf (addItem (Drawing) :entities f) "face.py"))))

0 comments on commit 1aec66f

Please sign in to comment.