add base32 hashing tests - currently failing

This commit is contained in:
Greg Hale 2018-09-11 22:44:58 -04:00
parent 73070f3865
commit 5de9fb6744

View 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") ]