From f3427b4b87d456b7ab2842300fe8f420c035024d Mon Sep 17 00:00:00 2001 From: Denis Tereshkin Date: Sun, 15 Oct 2017 18:11:52 +0700 Subject: [PATCH] Price test fix --- src/ATrade/Types.hs | 6 +++--- test/ArbitraryInstances.hs | 3 ++- 2 files changed, 5 insertions(+), 4 deletions(-) diff --git a/src/ATrade/Types.hs b/src/ATrade/Types.hs index 6397979..9c4b2c8 100644 --- a/src/ATrade/Types.hs +++ b/src/ATrade/Types.hs @@ -49,7 +49,7 @@ import System.ZMQ4.ZAP type TickerId = T.Text data DataType = Unknown - | Price + | LastTradePrice | OpenInterest | BestBid | BestOffer @@ -62,7 +62,7 @@ data DataType = Unknown instance Enum DataType where fromEnum x - | x == Price = 1 + | x == LastTradePrice = 1 | x == OpenInterest = 3 | x == BestBid = 4 | x == BestOffer = 5 @@ -75,7 +75,7 @@ instance Enum DataType where | otherwise = -1 toEnum x - | x == 1 = Price + | x == 1 = LastTradePrice | x == 3 = OpenInterest | x == 4 = BestBid | x == 5 = BestOffer diff --git a/test/ArbitraryInstances.hs b/test/ArbitraryInstances.hs index 0e9c7f2..8af7684 100644 --- a/test/ArbitraryInstances.hs +++ b/test/ArbitraryInstances.hs @@ -120,4 +120,5 @@ instance Arbitrary BrokerServerResponse where | t == 4 -> ResponseError <$> arbitrary instance Arbitrary P.Price where - arbitrary = P.Price <$> arbitrary + arbitrary = P.Price <$> (arbitrary `suchThat` (\p -> abs p < 1000000000 * 10000000)) +