You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
40 lines
1.1 KiB
40 lines
1.1 KiB
{-# LANGUAGE OverloadedStrings, TypeSynonymInstances, FlexibleInstances #-} |
|
{-# LANGUAGE MultiWayIf #-} |
|
|
|
module TestBrokerProtocol ( |
|
properties |
|
) where |
|
|
|
import Test.Tasty |
|
import Test.Tasty.SmallCheck as SC |
|
import Test.Tasty.QuickCheck as QC |
|
import Test.Tasty.HUnit |
|
import Test.QuickCheck.Instances hiding (Text) |
|
|
|
import ATrade.Broker.Protocol |
|
import ArbitraryInstances |
|
|
|
import Data.Aeson |
|
import Data.Scientific |
|
|
|
properties = testGroup "Broker.Protocol" [ |
|
testNotificationEncoding |
|
, testBrokerServerRequestEncoding |
|
, testBrokerServerResponseEncoding |
|
] |
|
|
|
testNotificationEncoding = QC.testProperty "Notification encoding" |
|
(\v -> case (decode . encode $ v :: Maybe Notification) of |
|
Just s -> s == v |
|
Nothing -> False) |
|
|
|
testBrokerServerRequestEncoding = QC.testProperty "BrokerServerRequest encoding" |
|
(\v -> case (decode . encode $ v :: Maybe BrokerServerRequest) of |
|
Just s -> s == v |
|
Nothing -> False) |
|
|
|
testBrokerServerResponseEncoding = QC.testProperty "BrokerServerResponse encoding" |
|
(\v -> case (decode . encode $ v :: Maybe BrokerServerResponse) of |
|
Just s -> s == v |
|
Nothing -> False) |
|
|
|
|