reorg quickcheck to a separate module
This commit is contained in:
parent
3449c0e8ec
commit
689bdae03a
3 changed files with 53 additions and 38 deletions
|
@ -23,12 +23,10 @@ module Utility.Scheduled (
|
|||
toRecurrance,
|
||||
toSchedule,
|
||||
parseSchedule,
|
||||
prop_schedule_roundtrips,
|
||||
prop_past_sane,
|
||||
) where
|
||||
|
||||
import Utility.Data
|
||||
import Utility.QuickCheck
|
||||
import Utility.PartialPrelude
|
||||
import Utility.Misc
|
||||
|
||||
|
@ -337,41 +335,6 @@ parseSchedule s = do
|
|||
recurrance = unwords rws
|
||||
scheduledtime = unwords tws
|
||||
|
||||
instance Arbitrary Schedule where
|
||||
arbitrary = Schedule <$> arbitrary <*> arbitrary
|
||||
|
||||
instance Arbitrary ScheduledTime where
|
||||
arbitrary = oneof
|
||||
[ pure AnyTime
|
||||
, SpecificTime
|
||||
<$> choose (0, 23)
|
||||
<*> choose (1, 59)
|
||||
]
|
||||
|
||||
instance Arbitrary Recurrance where
|
||||
arbitrary = oneof
|
||||
[ pure Daily
|
||||
, Weekly <$> arbday
|
||||
, Monthly <$> arbday
|
||||
, Yearly <$> arbday
|
||||
, Divisible
|
||||
<$> positive arbitrary
|
||||
<*> oneof -- no nested Divisibles
|
||||
[ pure Daily
|
||||
, Weekly <$> arbday
|
||||
, Monthly <$> arbday
|
||||
, Yearly <$> arbday
|
||||
]
|
||||
]
|
||||
where
|
||||
arbday = oneof
|
||||
[ Just <$> nonNegative arbitrary
|
||||
, pure Nothing
|
||||
]
|
||||
|
||||
prop_schedule_roundtrips :: Schedule -> Bool
|
||||
prop_schedule_roundtrips s = toSchedule (fromSchedule s) == Just s
|
||||
|
||||
prop_past_sane :: Bool
|
||||
prop_past_sane = and
|
||||
[ all (checksout oneMonthPast) (mplus1 ++ yplus1)
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue