Commit d0011409 authored by Neil Mitchell's avatar Neil Mitchell
Browse files

#146, add tests for chunksOfSize

parent 077bf477
module Settings.Builders.Ar (arBuilderArgs, arCmd) where
module Settings.Builders.Ar (arBuilderArgs, arCmd, chunksOfSize) where
import Base
import Expression
......
......@@ -6,6 +6,7 @@ module Test (testRules) where
import Way
import Development.Shake
import Test.QuickCheck
import Settings.Builders.Ar(chunksOfSize)
instance Arbitrary Way where
arbitrary = wayFromUnits <$> arbitrary
......@@ -17,6 +18,10 @@ testRules :: Rules ()
testRules =
phony "selftest" $ do
test $ \(x :: Way) -> read (show x) == x
test $ \n xs ->
let res = chunksOfSize n xs
in concat res == xs && all (\r -> length r == 1 || length (concat r) <= n) res
test $ chunksOfSize 3 ["a","b","c","defg","hi","jk"] == [["a","b","c"],["defg"],["hi"],["jk"]]
test :: Testable a => a -> Action ()
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment