Skip to content

Commit

Permalink
Adding tests for Semigroup stimes function.
Browse files Browse the repository at this point in the history
  • Loading branch information
recursion-ninja committed Feb 18, 2018
1 parent 133a4a9 commit 13f22e2
Showing 1 changed file with 5 additions and 0 deletions.
5 changes: 5 additions & 0 deletions test/TestSuite.hs
Original file line number Diff line number Diff line change
Expand Up @@ -335,6 +335,7 @@ semigroupProperties = testGroup "Properties of a Semigroup"
[ localOption (QuickCheckTests 10000)
$ testProperty "(<>) is associative" operationAssocativity
, testProperty "sconcat === foldr1 (<>)" foldableApplication
, testProperty "stimes n === mconcat . replicate n" repeatedApplication
]
where
operationAssocativity :: BitVector -> BitVector -> BitVector -> Property
Expand All @@ -349,6 +350,10 @@ semigroupProperties = testGroup "Properties of a Semigroup"
bvs = let x:xs = getNonEmpty nel
in x:|xs

repeatedApplication :: (NonNegative Int) -> BitVector -> Property
repeatedApplication (NonNegative i) bv =
stimes i bv === (mconcat . replicate i) bv


bitVectorProperties :: TestTree
bitVectorProperties = testGroup "BitVector properties"
Expand Down

0 comments on commit 13f22e2

Please sign in to comment.