more tests that passes

This commit is contained in:
didier amyot committed 2018-05-23 21:20:45 -04:00
1 parent 8fb9335411
commit 0d126be10c
4 files changed
+18 -12

No files matched your search

+4 -3
View File
@@ -4,6 +4,7 @@
(deftest test-match-buy-order-in-sell-book
(testing "Simplest case."
(let [sell-book (create-book {:type :sell :quantity 10 :price 2 :book.order/id 101})
@@ -27,9 +28,9 @@
(is (= trades [#:book.order{:quantity 8 :price 2 :book-id 105 :order-id 106 :type :sell}]))))
(testing "Simplest case IV."
(let [sell-book (create-book {:type :sell :quantity 2 :price 12 :book.order/id 107} {:type :sell :quantity 8 :price 12 :book.order/id 108})
order {:type :buy :quantity 10 :price 12 :book.order/id 109}
(let [sell-book (create-book {:type :sell :quantity 2 :price 12 :book.order/id 107} {:type :sell :quantity 8 :price 13 :book.order/id 108})
order {:type :buy :quantity 10 :price 13 :book.order/id 109}
[trades new-book] (match-buy-order-in-sell-book sell-book order)]
(is (= new-book []))
(is (= trades [#:book.order{:quantity 2 :price 12 :book-id 107 :order-id 109 :type :sell}
#:book.order{:quantity 8 :price 12 :book-id 108 :order-id 109 :type :sell}])))))
#:book.order{:quantity 8 :price 13 :book-id 108 :order-id 109 :type :sell}])))))