mirror of
https://github.com/haskell-nix/hnix-store.git
synced 2024-09-11 18:05:56 +03:00
add base32 hashing tests - currently failing
This commit is contained in:
parent
73070f3865
commit
5de9fb6744
20
hnix-store-core/tests/Hash.hs
Normal file
20
hnix-store-core/tests/Hash.hs
Normal file
@ -0,0 +1,20 @@
|
|||||||
|
{-# LANGUAGE OverloadedStrings #-}
|
||||||
|
|
||||||
|
module Hash where
|
||||||
|
|
||||||
|
import qualified Data.ByteString.Char8 as BSC
|
||||||
|
import Data.Foldable
|
||||||
|
import Data.Semigroup
|
||||||
|
import Test.Tasty.Hspec
|
||||||
|
import Test.Tasty.HUnit
|
||||||
|
import System.Nix.Hash
|
||||||
|
|
||||||
|
spec_hashBase32truncateParity :: Spec
|
||||||
|
spec_hashBase32truncateParity = describe "hashBase32" $
|
||||||
|
for_ testCases $ \(testCase, expectation) ->
|
||||||
|
it ("computes correct base32 hash for string " <> BSC.unpack testCase) $
|
||||||
|
hashToBase32 (hash testCase) `shouldBe` expectation
|
||||||
|
where
|
||||||
|
testCases :: [(BSC.ByteString, BSC.ByteString)]
|
||||||
|
testCases =
|
||||||
|
[ ("hello", "hcv22wi9b082i6qy160jgi9cvw3am153") ]
|
Loading…
Reference in New Issue
Block a user