first draft of the stock exchange

This commit is contained in:
didier amyot committed 2018-06-01 19:04:52 -04:00
1 parent b1ba21f391
commit c099924a89
7 files changed
+296 -24

No files matched your search

+7 -2
View File
@@ -1,10 +1,14 @@
(ns book.test-PersistentSortedList
(:require [clojure.test :refer :all]
[book.match :refer [sorted-list sorted-list-by]]))
[book.util :refer [sorted-list sorted-list-by]]))
(deftest test-match-buy-order-in-sell-book
(testing "constructing"
(is (empty? (map nil? (sorted-list)))))
;; The following are tests that fails...
;(is (empty? (vec (sorted-list)))))
(testing "Test ordering."
(is (= (sorted-list 1 2 3) (sorted-list 3 2 1)))
(is (= (sorted-list 1 2 2 3) (sorted-list 3 2 1 2))))
@@ -16,7 +20,8 @@
(is (= (rest (sorted-list 1 2 3)) (sorted-list 2 3)))
(is (= (rest (sorted-list 1 2 3 2)) (sorted-list 2 2 3)))
(is (= (rest (sorted-list 1)) (list)))
(is (= (rest (sorted-list)) (list))))
(is (empty? (rest (sorted-list))))
(is (= (str (type (rest (sorted-list)))) "class book.PersistentSortedList")))
(testing "next"
(is (= (next (sorted-list 1 2 3)) (sorted-list 2 3)))
(is (= (next (sorted-list 1 2 3 2)) (sorted-list 2 2 3)))