word24 1.0.4 → 1.0.5
raw patch · 4 files changed
+26/−15 lines, 4 filesdep ~test-framework
Dependency ranges changed: test-framework
Files
- src/Data/Int/Int24.hs +2/−1
- src/Data/Word/Word24.hs +2/−1
- tests/testword24.hs +19/−10
- word24.cabal +3/−3
src/Data/Int/Int24.hs view
@@ -164,7 +164,8 @@ {-# INLINE shiftR #-} -- same as the default definition, but we want it inlined (#2376) x `shiftR` i = x `shift` (-i)- bit = bitDefault+ bit n = case bit n of+ I32# x -> I24# (narrow24Int# x) testBit = testBitDefault popCount = popCountDefault
src/Data/Word/Word24.hs view
@@ -124,7 +124,8 @@ !(I# i'#) = i `mod` 24 bitSize _ = 24 isSigned _ = False- bit = bitDefault+ bit n = case bit n of+ W32# x -> W24# (narrow24Word# x) testBit (W24# x) n = testBit (W32# x) n popCount (W24# x) = popCount (W32# x)
tests/testword24.hs view
@@ -133,6 +133,9 @@ prop_comp a = complement (complement a) == a where types = a :: Word24 +prop_bit_ident q (NonNegative j) k =+ testBit (bit j `asTypeOf` q) k == (j == k)+ -- Word Storable properties prop_sizeOf a = sizeOf a == 3 where types = a :: Word24@@ -267,7 +270,8 @@ -- ---------------------------------------- -- tests tests = [- testGroup "Word24" [+ testGroup "Word24"+ [ testGroup "basic" [ testProperty "add. identity" prop_addIdent ,testProperty "mult. identity" prop_multIdent ,testProperty "unsigned" prop_unsigned@@ -280,7 +284,7 @@ ,testProperty "signum" prop_signum ,testProperty "Real identity" prop_real ]- ,testGroup "Word24 Integral instance" [+ ,testGroup "Integral instance" [ testProperty "quot" prop_quot ,testProperty "rem" prop_rem ,testProperty "div" prop_div@@ -288,7 +292,7 @@ ,testProperty "quotRem" prop_quotrem ,testProperty "divmod" prop_divmod ]- ,testGroup "Word24 Enum instance" [+ ,testGroup "Enum instance" [ testProperty "enum succ" prop_enum1 ,testProperty "enum pred" prop_enum2 ,testProperty "toEnum" prop_enum3@@ -296,7 +300,7 @@ ,testProperty "enumFromTo" prop_enum5 ,testProperty "enumFromThen" prop_enum6 ]- ,testGroup "Word24 binary instance" [+ ,testGroup "Bits instance" [ testProperty "binary and" prop_and ,testProperty "binary or" prop_or ,testProperty "binary xor" prop_xor@@ -307,12 +311,15 @@ ,testProperty "binary shiftR" prop_shiftR2 ,testProperty "binary rotate" prop_rotate ,testProperty "binary complement" prop_comp+ ,testProperty "bit/testBit" (prop_bit_ident (0::Word24)) ]- ,testGroup "Word24 Storable instance" [+ ,testGroup "Storable instance" [ testProperty "sizeOf Word24" prop_sizeOf ,testProperty "aligntment" prop_align ]- ,testGroup "Int24" [+ ]+ ,testGroup "Int24"+ [testGroup "basic" [ testProperty "add. identity" prop_addIdentI ,testProperty "mult. identity" prop_multIdentI ,testProperty "Int16/Int24 conversion" prop_smallerI@@ -324,7 +331,7 @@ ,testProperty "signum" prop_signumI ,testProperty "Real identity" prop_realI ]- ,testGroup "Int24 Integral instance" [+ ,testGroup "Integral instance" [ testProperty "quot" prop_quotI ,testProperty "rem" prop_remI ,testProperty "div" prop_divI@@ -332,7 +339,7 @@ ,testProperty "quotRem" prop_quotremI ,testProperty "divmod" prop_divmodI ]- ,testGroup "Int24 Enum instance" [+ ,testGroup "Enum instance" [ testProperty "enum succ" prop_enum1I ,testProperty "enum pred" prop_enum2I ,testProperty "toEnum" prop_enum3I@@ -340,7 +347,7 @@ ,testProperty "enumFromTo" prop_enum5I ,testProperty "enumFromThen" prop_enum6I ]- ,testGroup "Int24 binary instance" [+ ,testGroup "Bits instance" [ testProperty "binary and" prop_andI ,testProperty "binary or" prop_orI ,testProperty "binary xor" prop_xorI@@ -351,12 +358,14 @@ ,testProperty "binary shiftR" prop_shiftR2I ,testProperty "binary rotate" prop_rotateI ,testProperty "binary complement" prop_compI+ ,testProperty "bit/testBit" (prop_bit_ident (0::Int24)) ]- ,testGroup "Int24 Storable instance" [+ ,testGroup "Storable instance" [ testProperty "sizeOf Int24" prop_sizeOfI ,testProperty "aligntment" prop_alignI ] ]+ ] -- ---------------------------------------- -- entry point
word24.cabal view
@@ -1,5 +1,5 @@ name: word24-version: 1.0.4+version: 1.0.5 synopsis: 24-bit word and int types for GHC description: 24-bit Word and Int data types. category: Data@@ -38,13 +38,13 @@ type: exitcode-stdio-1.0 main-is: testword24.hs hs-source-dirs: tests src- ghc-options: -fhpc -hpcdir dist/hpc/mix/word24-1.0.4+ ghc-options: -fhpc -hpcdir dist/hpc/mix/word24-1.0.5 build-depends: base, word24, QuickCheck >= 2 && < 3,- test-framework >= 0.2 && < 0.7,+ test-framework >= 0.2 && < 0.9, test-framework-quickcheck2 >= 0.2 && < 0.7 benchmark bench24