urbit-hob 0.3.1 → 0.3.2
raw patch · 3 files changed
+18/−4 lines, 3 files
Files
- lib/Data/Serialize/Extended.hs +6/−3
- test/Co/Tests/Unit.hs +11/−0
- urbit-hob.cabal +1/−1
lib/Data/Serialize/Extended.hs view
@@ -11,9 +11,12 @@ -- | Simple little-endian ByteString encoding for Naturals. unroll :: Natural -> BS.ByteString-unroll = BS.pack . unfoldr step where- step 0 = Nothing- step i = Just (fromIntegral i, i `shiftR` 8)+unroll nat = case nat of+ 0 -> BS.singleton 0+ _ -> BS.pack (unfoldr step nat)+ where+ step 0 = Nothing+ step i = Just (fromIntegral i, i `shiftR` 8) -- | Simple little-endian ByteString decoding for Naturals. roll :: BS.ByteString -> Natural
test/Co/Tests/Unit.hs view
@@ -67,3 +67,14 @@ Co.renderPatq (Co.patq big_128_02) `shouldBe` patq_128_02 + describe "parsePatp" $+ it "yields an equivalent internal representation with patp for ~zod" $ do+ let pzod = Co.parsePatp "~zod"+ ezod = Co.patp 0+ fmap (== ezod) pzod `shouldBe` Right True++ describe "parsePatq" $+ it "yields an equivalent internal representation with patq for ~zod" $ do+ let pzod = Co.parsePatq "~zod"+ ezod = Co.patq 0+ fmap (== ezod) pzod `shouldBe` Right True
urbit-hob.cabal view
@@ -1,5 +1,5 @@ name: urbit-hob-version: 0.3.1+version: 0.3.2 synopsis: Hoon-style atom manipulation and printing functions homepage: https://github.com/urbit/urbit-hob bug-reports: https://github.com/urbit/urbit-hob/issues