Skip to content

Commit 0f8d8d1

Browse files
committed
Add 'golden' test that Text hash doesn't change
1 parent d31d812 commit 0f8d8d1

File tree

1 file changed

+8
-0
lines changed

1 file changed

+8
-0
lines changed

tests/Regress.hs

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,6 @@
11
{-# LANGUAGE CPP #-}
22
{-# LANGUAGE DeriveGeneric #-}
3+
{-# LANGUAGE OverloadedStrings #-}
34

45
module Regress (regressions) where
56

@@ -9,13 +10,16 @@ import Test.HUnit ((@=?))
910
import GHC.Generics (Generic)
1011
import Data.List (nub)
1112
import Data.Fixed (Pico)
13+
import Data.Text (Text)
1214

1315
#ifdef HAVE_MMAP
1416
import qualified Regress.Mmap as Mmap
1517
#endif
1618

1719
import Data.Hashable
1820

21+
#include "MachDeps.h"
22+
1923
regressions :: [F.Test]
2024
regressions = [] ++
2125
#ifdef HAVE_MMAP
@@ -35,6 +39,10 @@ regressions = [] ++
3539
let ns = take 20 $ iterate S Z
3640
let hs = map hash ns
3741
hs @=? nub hs
42+
#if WORD_SIZE_IN_BITS == 64
43+
, testCase "64 bit Text" $ do
44+
hash ("hello world" :: Text) @=? 6567282331143050109
45+
#endif
3846
]
3947
where
4048
nullaryCase :: Int -> SumOfNullary -> IO ()

0 commit comments

Comments
 (0)