Skip to content

Commit

Permalink
adding PackIntSpec
Browse files Browse the repository at this point in the history
  • Loading branch information
kazu-yamamoto committed Jan 22, 2024
1 parent 7bbea15 commit e836fa4
Showing 1 changed file with 14 additions and 0 deletions.
14 changes: 14 additions & 0 deletions warp/test/PackIntSpec.hs
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
module PackIntSpec (spec) where

import qualified Data.ByteString.Char8 as C8
import Network.Wai.Handler.Warp.PackInt
import Test.Hspec
import Test.Hspec.QuickCheck
import qualified Test.QuickCheck as QC

spec :: Spec
spec = describe "readInt64" $ do
prop "" $ \n -> packIntegral (abs n :: Int) == C8.pack (show (abs n))
prop "" $ \(QC.Large n) ->
let n' = fromIntegral (abs n :: Int)
in packIntegral (n' :: Int) == C8.pack (show n')

0 comments on commit e836fa4

Please sign in to comment.