Skip to content

Commit 13f22e2

Browse files
Adding tests for Semigroup stimes function.
1 parent 133a4a9 commit 13f22e2

File tree

1 file changed

+5
-0
lines changed

1 file changed

+5
-0
lines changed

test/TestSuite.hs

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -335,6 +335,7 @@ semigroupProperties = testGroup "Properties of a Semigroup"
335335
[ localOption (QuickCheckTests 10000)
336336
$ testProperty "(<>) is associative" operationAssocativity
337337
, testProperty "sconcat === foldr1 (<>)" foldableApplication
338+
, testProperty "stimes n === mconcat . replicate n" repeatedApplication
338339
]
339340
where
340341
operationAssocativity :: BitVector -> BitVector -> BitVector -> Property
@@ -349,6 +350,10 @@ semigroupProperties = testGroup "Properties of a Semigroup"
349350
bvs = let x:xs = getNonEmpty nel
350351
in x:|xs
351352

353+
repeatedApplication :: (NonNegative Int) -> BitVector -> Property
354+
repeatedApplication (NonNegative i) bv =
355+
stimes i bv === (mconcat . replicate i) bv
356+
352357

353358
bitVectorProperties :: TestTree
354359
bitVectorProperties = testGroup "BitVector properties"

0 commit comments

Comments
 (0)