|
|
|
@ -35,6 +35,7 @@ properties = testGroup "Types" [ |
|
|
|
, testTradeSerialization |
|
|
|
, testTradeSerialization |
|
|
|
, testPrice1 |
|
|
|
, testPrice1 |
|
|
|
, testPrice2 |
|
|
|
, testPrice2 |
|
|
|
|
|
|
|
, testPriceDecompose |
|
|
|
] |
|
|
|
] |
|
|
|
|
|
|
|
|
|
|
|
testTickSerialization = QC.testProperty "Deserialize serialized tick" |
|
|
|
testTickSerialization = QC.testProperty "Deserialize serialized tick" |
|
|
|
@ -92,3 +93,7 @@ testPrice2 = QC.testProperty "toDouble . fromDouble $ Price" $ |
|
|
|
QC.forAll (arbitrary `suchThat` (< 1000000000)) (\d -> let newd = (P.toDouble . P.fromDouble) d in |
|
|
|
QC.forAll (arbitrary `suchThat` (< 1000000000)) (\d -> let newd = (P.toDouble . P.fromDouble) d in |
|
|
|
(abs (newd - d) < 0.000001)) |
|
|
|
(abs (newd - d) < 0.000001)) |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
testPriceDecompose = QC.testProperty "Price decompose" |
|
|
|
|
|
|
|
(\p -> let (i, f) = decompose p in |
|
|
|
|
|
|
|
i * 1000000000 + (fromInteger . fromIntegral) f == priceQuants p) |
|
|
|
|
|
|
|
|
|
|
|
|