From 13f22e27b91d2befcee35bfed5946379bed67423 Mon Sep 17 00:00:00 2001 From: Alex Washburn Date: Sat, 17 Feb 2018 22:10:13 -0500 Subject: [PATCH] Adding tests for Semigroup stimes function. --- test/TestSuite.hs | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/test/TestSuite.hs b/test/TestSuite.hs index 2a97fb3..3d456af 100644 --- a/test/TestSuite.hs +++ b/test/TestSuite.hs @@ -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 @@ -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"