memory 0.14 → 0.14.1
raw patch · 4 files changed
+31/−3 lines, 4 filesdep −foundation
Dependencies removed: foundation
Files
- CHANGELOG.md +13/−0
- Data/ByteArray/Bytes.hs +1/−1
- memory.cabal +1/−2
- tests/Tests.hs +16/−0
CHANGELOG.md view
@@ -1,3 +1,16 @@+## 0.14.1++* Fix `Show` instance of Bytes (Oliver Chéron)++## 0.14++* Improve fromW64BE+* Add IsString instance for ScrubbedBytes++## 0.13++* Add combinator to check for end of parsing.+ ## 0.12 * Fix compilation with mkWeak and latest GHC (Lars Kuhtz)
Data/ByteArray/Bytes.hs view
@@ -154,7 +154,7 @@ chunkLoop idx | booleanPrim (len ==# idx) = [] | booleanPrim ((len -# idx) ># 63#) =- bytesLoop idx (idx +# 64#) (chunkLoop (idx +# 64#))+ bytesLoop idx 64# (chunkLoop (idx +# 64#)) | otherwise = bytesLoop idx (len -# idx) xs
memory.cabal view
@@ -1,5 +1,5 @@ Name: memory-Version: 0.14+Version: 0.14.1 Synopsis: memory and related abstraction stuff Description: Chunk of memory, polymorphic byte array management and manipulation@@ -71,7 +71,6 @@ Data.ByteArray.MemView Data.ByteArray.View Build-depends: base >= 4 && < 5- , foundation , ghc-prim -- FIXME armel or mispel is also little endian. -- might be a good idea to also add a runtime autodetect mode.
tests/Tests.hs view
@@ -4,6 +4,7 @@ import Imports import Utils+import Data.Char (chr) import Data.Word import Data.ByteArray (Bytes, ScrubbedBytes, ByteArray) import qualified Data.ByteArray as B@@ -52,6 +53,19 @@ , testGroup "ScrubbedBytes" (l withScrubbedBytesWitness) ] +testShowProperty :: Testable a+ => String+ -> (forall ba . (Show ba, Eq ba, ByteArray ba) => (ba -> ba) -> ([Word8] -> String) -> a)+ -> TestTree+testShowProperty x p =+ testGroup x+ [ testProperty "Bytes" (p withBytesWitness showLikeString)+ , testProperty "ScrubbedBytes" (p withScrubbedBytesWitness showLikeEmptySB)+ ]+ where+ showLikeString l = show $ map (chr . fromIntegral) l+ showLikeEmptySB _ = show (withScrubbedBytesWitness B.empty)+ base64Kats = [ ("pleasure.", "cGxlYXN1cmUu") , ("leasure.", "bGVhc3VyZS4=")@@ -145,6 +159,8 @@ , testGroupBackends "hashing" $ \witnessID -> [ testGroup "SipHash" $ SipHash.tests witnessID ]+ , testShowProperty "showing" $ \witnessID expectedShow (Words8 l) ->+ (show . witnessID . B.pack $ l) == expectedShow l ] where basicProperties witnessID =