Skip to content

Commit

Permalink
compile test suite at definition time, not at runtime
Browse files Browse the repository at this point in the history
  • Loading branch information
cosmos72 committed Mar 12, 2014
1 parent 6c12b87 commit e84b28d
Show file tree
Hide file tree
Showing 11 changed files with 36 additions and 36 deletions.
16 changes: 8 additions & 8 deletions test/atomic.lisp
Expand Up @@ -18,10 +18,10 @@
(def-suite atomic-suite :in suite)
(in-suite atomic-suite)

(test rerun
(def-test rerun (:compile-at :definition-time)
(signals rerun-error (stmx::rerun)))

(test tx-read-of
(def-test tx-read-of (:compile-at :definition-time)
(let ((log (make-tlog))
(var (tvar 1)))
(is (= 1 (raw-value-of var)))
Expand All @@ -44,7 +44,7 @@
(set-tvar-value-and-version var 1 +invalid-version+)
(is-true (valid? log))))

(test valid?
(def-test valid? (:compile-at :definition-time)
(valid?-test))

(defun commit-test ()
Expand All @@ -55,7 +55,7 @@
(is-true (commit log))
(is (= 2 (raw-value-of var)))))

(test commit
(def-test commit (:compile-at :definition-time)
(commit-test))

(defun $-test ()
Expand All @@ -72,7 +72,7 @@
(is (= 2 (raw-value-of var))))
(is (= 2 ($ var)))))

(test $
(def-test $ (:compile-at :definition-time)
($-test))

(defun atomic-test ()
Expand All @@ -89,15 +89,15 @@

(is (= 1 ($ var)))))

(test atomic
(def-test atomic (:compile-at :definition-time)
(atomic-test))



(define-condition test-error (simple-error)
())

(test rollback
(def-test rollback (:compile-at :definition-time)
(let1 var (tvar 1)

(signals test-error
Expand All @@ -121,7 +121,7 @@



(test transaction-return-from
(def-test transaction-return-from (:compile-at :definition-time)
(let1 var (tvar 1)

(transaction-return-from-setf var 2 :return-from? nil)
Expand Down
8 changes: 4 additions & 4 deletions test/conflict.lisp
Expand Up @@ -39,7 +39,7 @@

(is (= 11 ($ var))))) ;; 10 for "(setf (raw-value-of var) 10)" plus 1 for "(incf ($ var))"

(test conflict
(def-test conflict (:compile-at :definition-time)
(conflict-test))

(defun conflict-test-1 ()
Expand Down Expand Up @@ -74,7 +74,7 @@

(is (= 2 ($ var)))))

(test conflict-1
(def-test conflict-1 (:compile-at :definition-time)
(conflict-test-1))

(defun conflict-test-2 ()
Expand Down Expand Up @@ -106,7 +106,7 @@
(is (= 3 ($ b)))))


(test conflict-2
(def-test conflict-2 (:compile-at :definition-time)
(conflict-test-2))

(defstruct ipc
Expand Down Expand Up @@ -242,5 +242,5 @@

;; CMUCL currently does not have native threads
#-cmucl
(test conflict-locked
(def-test conflict-locked (:compile-at :definition-time)
(conflict-locked-test))
4 changes: 2 additions & 2 deletions test/ghash-table.lisp
Expand Up @@ -20,7 +20,7 @@



(test new-ghash-table
(def-test new-ghash-table (:compile-at :definition-time)
(let1 h (new 'ghash-table :test '= :hash 'identity)
(is (= 0 (ghash-table-count h)))
(do-ghash (key value) h
Expand Down Expand Up @@ -104,7 +104,7 @@



(test ghash-table
(def-test ghash-table (:compile-at :definition-time)
(test-new-ghash-table #'fixnum<))


Expand Down
6 changes: 3 additions & 3 deletions test/on-commit.lisp
Expand Up @@ -18,7 +18,7 @@
(def-suite on-commit-suite :in suite)
(in-suite on-commit-suite)

(test on-commit
(def-test on-commit (:compile-at :definition-time)
(let (x)
(atomic
(before-commit
Expand All @@ -30,7 +30,7 @@
(is (eq 'after x))))


(test before-commit-fails
(def-test before-commit-fails (:compile-at :definition-time)
(let ((var (tvar 'original)))

(signals test-error
Expand All @@ -53,7 +53,7 @@
(is (eq 'original (raw-value-of var)))))


(test after-commit-fails
(def-test after-commit-fails (:compile-at :definition-time)
(let ((var (tvar 'original)))

(signals test-error
Expand Down
6 changes: 3 additions & 3 deletions test/orelse.lisp
Expand Up @@ -82,10 +82,10 @@
(eq value unique)
(empty? place))))))))

(test orelse
(def-test orelse (:compile-at :definition-time)
(orelse-test))

(test orelse-atomic
(def-test orelse-atomic (:compile-at :definition-time)
(atomic
(orelse-test)))

Expand Down Expand Up @@ -227,5 +227,5 @@ and finishes after each thread executed ITERATIONS loops, returning the final ce
(let1 total (apply #'+ cells)
(is-true (= total (+ 1.5 (* 4 iterations)))))))

(test orelse-thread4
(def-test orelse-thread4 (:compile-at :definition-time)
(orelse-thread4-test 10000))
4 changes: 2 additions & 2 deletions test/rbmap.lisp
Expand Up @@ -84,7 +84,7 @@ bmap-count must be the actual nodes count, root must be black."
nil))


(test new-rbmap
(def-test new-rbmap (:compile-at :definition-time)
(let1 m (new 'rbmap :pred 'fixnum<)
(is-true (gmap-empty? m))
(is (= 0 (gmap-count m)))
Expand Down Expand Up @@ -172,6 +172,6 @@ bmap-count must be the actual nodes count, root must be black."
(fsck-rbmap m1 m2)
(rem-gmap m2 key)))))

(test rbmap
(def-test rbmap (:compile-at :definition-time)
(test-rbmap-class 'rbmap))

6 changes: 3 additions & 3 deletions test/retry.lisp
Expand Up @@ -28,10 +28,10 @@
(is-true (= (take c) 2))
(is-true (empty? c))))

(test cell
(def-test cell (:compile-at :definition-time)
(cell-test))

(test cell-atomic
(def-test cell-atomic (:compile-at :definition-time)
(atomic (cell-test)))


Expand Down Expand Up @@ -109,5 +109,5 @@
(is-true (= expected (+ c1 c2))))))))


(test retry-thread4
(def-test retry-thread4 (:compile-at :definition-time)
(retry-thread4-test 10000))
8 changes: 4 additions & 4 deletions test/simple-tvector.lisp
Expand Up @@ -19,7 +19,7 @@
(in-suite simple-tvector-suite)


(test new-simple-tvector
(def-test new-simple-tvector (:compile-at :definition-time)
(let* ((n 10)
(tvec (simple-tvector n)))
;; default initial-element is 0
Expand All @@ -30,7 +30,7 @@
(incf count))
(is (= n count)))))

(test new-simple-tvector2
(def-test new-simple-tvector2 (:compile-at :definition-time)
(let* ((n 10)
(tvec (simple-tvector n :initial-element n)))
(let1 count 0
Expand All @@ -40,7 +40,7 @@
(is (= n count)))))


(test new-simple-tvector3
(def-test new-simple-tvector3 (:compile-at :definition-time)
(let* ((n 10)
(tvec (simple-tvector n :initial-contents
(loop for i from 0 to (1- n)
Expand All @@ -53,7 +53,7 @@



(test svref-simple-tvector
(def-test svref-simple-tvector (:compile-at :definition-time)
(let* ((n 10)
(tvec (simple-tvector n)))
;; default initial-element is 0
Expand Down
4 changes: 2 additions & 2 deletions test/thash-table.lisp
Expand Up @@ -20,7 +20,7 @@



(test new-thash-table
(def-test new-thash-table (:compile-at :definition-time)
(let1 h (new 'thash-table :test '= :hash 'identity)
(is (= 0 (ghash-table-count h)))
(do-ghash (key value) h
Expand All @@ -43,6 +43,6 @@



(test thash-table
(def-test thash-table (:compile-at :definition-time)
(test-new-thash-table #'fixnum<))

6 changes: 3 additions & 3 deletions test/tmap.lisp
Expand Up @@ -42,12 +42,12 @@
t))


(test tmap-rollback
(def-test tmap-rollback (:compile-at :definition-time)
(test-tmap-rollback))

(test tmap
(def-test tmap (:compile-at :definition-time)
(test-rbmap-class 'tmap))

(test tmap-atomic
(def-test tmap-atomic (:compile-at :definition-time)
(atomic (test-rbmap-class 'tmap)))

4 changes: 2 additions & 2 deletions test/txhash.lisp
Expand Up @@ -20,7 +20,7 @@



(test new-txhash
(def-test new-txhash (:compile-at :definition-time)
(let1 h (make-txhash-table)
(is (= 0 (txhash-table-count h)))
(do-txhash (key value) h
Expand Down Expand Up @@ -96,7 +96,7 @@
(is-equal-txhash-and-hash-table txh hash pred)))))


(test txhash
(def-test txhash (:compile-at :definition-time)
(test-txhash #'tvar>))


Expand Down

0 comments on commit e84b28d

Please sign in to comment.