somehow, things start to work togheter
This commit is contained in:
1 parent
baf0d9840c
commit
27b4fd5727
10 files changed
+197
-113
No files matched your search
@@ -1,11 +1,14 @@
|
||||
(ns skirmish.exchange.exchange-test
|
||||
(:import [skirmish.PersistentSortedList])
|
||||
(:require [midje.sweet :refer :all]
|
||||
[orchestra.spec.test :as st]
|
||||
[skirmish.exchange.exchange :refer :all]
|
||||
[skirmish.exchange.match :refer [create-buy-book
|
||||
create-sell-book
|
||||
match-order-in-book]]))
|
||||
|
||||
(st/instrument)
|
||||
|
||||
(def PersistentSortedList? (comp #(= % skirmish.PersistentSortedList) type))
|
||||
|
||||
(facts "the exchange as an whole"
|
||||
@@ -70,13 +73,21 @@
|
||||
book-4 => expt-book-4)))
|
||||
|
||||
(facts "get-processed-orders"
|
||||
(fact "ss"
|
||||
(fact "bug numero uno"
|
||||
(let [sell-book (create-buy-book {:type :buy :quantity 2 :price 14 :book.order/id 116}
|
||||
{:type :buy :quantity 8 :price 13 :book.order/id 117})
|
||||
order {:type :sell :quantity 21 :price 13 :book.order/id 118}
|
||||
[trades new-book leftover-order] (match-order-in-book sell-book order)
|
||||
processed-order (get-processed-orders order leftover-order trades sell-book)]
|
||||
processed-order => seq)));;;
|
||||
processed-order => seq));;;
|
||||
(fact "bug numero dos"
|
||||
(let [order {:type :sell, :quantity 10, :price 2, :book.order/id 1}
|
||||
leftover-order nil
|
||||
trades [#:book.order{:type :buy, :quantity 10, :price 3, :order-id 1, :book-id 0}]
|
||||
book {:sell (create-sell-book)
|
||||
:buy (create-buy-book {:type :buy, :quantity 15, :price 3, :book.order/id 0})}
|
||||
ret (get-processed-orders order leftover-order trades (:buy book))]
|
||||
(count ret) => 3)))
|
||||
|
||||
|
||||
|
||||
Reference in new issue
Block a user