Skip to content

Commit 2a13ee8

Browse files
committed
Serialisation test now also checks lazy bytestrings
1 parent 3129682 commit 2a13ee8

File tree

6 files changed

+16
-8
lines changed

6 files changed

+16
-8
lines changed

CHANGELOG.md

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,10 @@ All notable changes to this project will be documented in this file.
44
The format is based on [Keep a Changelog](http://keepachangelog.com/en/1.0.0/)
55
and this project adheres to [Semantic Versioning](http://semver.org/spec/v2.0.0.html).
66

7+
## 0.21.2
8+
### Changed
9+
- Serialisation test now works for both strict and lazy bytestrings.
10+
711
## 0.21.1
812
### Changed
913
- Make Base58 faster.

haskoin-core.cabal

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@ cabal-version: 1.12
55
-- see: https://github.com/sol/hpack
66

77
name: haskoin-core
8-
version: 0.21.1
8+
version: 0.21.2
99
synopsis: Bitcoin & Bitcoin Cash library for Haskell
1010
description: Please see the README on GitHub at <https://github.com/haskoin/haskoin-core#readme>
1111
category: Bitcoin, Finance, Network

package.yaml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
name: haskoin-core
2-
version: 0.21.1
2+
version: 0.21.2
33
synopsis: Bitcoin & Bitcoin Cash library for Haskell
44
description: Please see the README on GitHub at <https://github.com/haskoin/haskoin-core#readme>
55
category: Bitcoin, Finance, Network

src/Haskoin/Util/Arbitrary/Util.hs

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -38,6 +38,7 @@ import qualified Data.Aeson.Encoding as A
3838
import qualified Data.Aeson.Types as A
3939
import Data.ByteString (ByteString, pack)
4040
import qualified Data.ByteString.Short as BSS
41+
import Data.ByteString.Lazy (fromStrict, toStrict)
4142
import Data.Bytes.Get
4243
import Data.Bytes.Put
4344
import Data.Bytes.Serial
@@ -138,8 +139,11 @@ testSerial ::
138139
(Eq a, Show a, T.Typeable a, Serial a) => Gen a -> Spec
139140
testSerial gen =
140141
prop ("Binary encoding/decoding identity for " <> name) $
141-
forAll gen $ \x ->
142+
forAll gen $ \x -> do
143+
(runGetL deserialize . runPutL . serialize) x `shouldBe` x
144+
(runGetL deserialize . fromStrict . runPutS . serialize) x `shouldBe` x
142145
(runGetS deserialize . runPutS . serialize) x `shouldBe` Right x
146+
(runGetS deserialize . toStrict . runPutL . serialize) x `shouldBe` Right x
143147
where
144148
name = show $ T.typeRep $ proxy gen
145149
proxy :: Gen a -> Proxy a

stack.yaml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
resolver: lts-18.18
1+
resolver: lts-19.3
22
nix:
33
packages:
44
- secp256k1

stack.yaml.lock

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@
66
packages: []
77
snapshots:
88
- completed:
9-
size: 586296
10-
url: https://raw.githubusercontent.com/commercialhaskell/stackage-snapshots/master/lts/18/18.yaml
11-
sha256: 63539429076b7ebbab6daa7656cfb079393bf644971156dc349d7c0453694ac2
12-
original: lts-18.18
9+
size: 617368
10+
url: https://raw.githubusercontent.com/commercialhaskell/stackage-snapshots/master/lts/19/3.yaml
11+
sha256: a209d3455279ee76eb45f01f73bbb960ceaaa8dfad8891435384689df4dcb653
12+
original: lts-19.3

0 commit comments

Comments
 (0)