-
Notifications
You must be signed in to change notification settings - Fork 7
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
cleanup: Remove QuickCheck dependency.
- Loading branch information
Showing
11 changed files
with
108 additions
and
107 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,16 @@ | ||
{-# LANGUAGE LambdaCase #-} | ||
module Data.MessagePack.TagsSpec where | ||
|
||
import Data.MessagePack.Tags | ||
import Test.Hspec (Spec, describe, it, shouldSatisfy) | ||
|
||
spec :: Spec | ||
spec = | ||
describe "Assoc" $ | ||
it "has a working Read/Show implementation" $ do | ||
(TAG_nil :: Int) `shouldSatisfy` \case | ||
TAG_nil -> True | ||
_ -> False | ||
(TAG_nil :: Integer) `shouldSatisfy` \case | ||
TAG_nil -> True | ||
_ -> False |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,33 @@ | ||
{-# OPTIONS_GHC -fno-warn-orphans #-} | ||
{-# LANGUAGE StrictData #-} | ||
{-# LANGUAGE Trustworthy #-} | ||
module Test.QuickCheck.Instances.MessagePack () where | ||
|
||
import qualified Data.ByteString as S | ||
import Data.MessagePack.Types (Assoc (..), Object (..)) | ||
import qualified Data.Text as T | ||
import Test.QuickCheck.Arbitrary (Arbitrary, arbitrary) | ||
import qualified Test.QuickCheck.Gen as Gen | ||
import Test.QuickCheck.Instances.ByteString () | ||
import Test.QuickCheck.Instances.Vector () | ||
|
||
|
||
instance Arbitrary Object where | ||
arbitrary = Gen.sized $ \n -> Gen.oneof | ||
[ pure ObjectNil | ||
, ObjectBool <$> arbitrary | ||
, ObjectInt <$> negatives | ||
, ObjectWord <$> arbitrary | ||
, ObjectFloat <$> arbitrary | ||
, ObjectDouble <$> arbitrary | ||
, ObjectStr <$> (T.pack <$> arbitrary) | ||
, ObjectBin <$> (S.pack <$> arbitrary) | ||
, ObjectArray <$> Gen.resize (n `div` 2) arbitrary | ||
, ObjectMap <$> Gen.resize (n `div` 4) arbitrary | ||
, ObjectExt <$> arbitrary <*> arbitrary | ||
] | ||
where negatives = Gen.choose (minBound, -1) | ||
|
||
|
||
instance Arbitrary a => Arbitrary (Assoc a) where | ||
arbitrary = Assoc <$> arbitrary |