chore(test): add test for ExamRoomRandom

This commit is contained in:
Wolfgang Witt 2021-02-08 17:07:59 +01:00 committed by Wolfgang Witt
parent b6df520fab
commit dbd7726bbb

View File

@ -1,5 +1,4 @@
{-# OPTIONS_GHC -Wno-redundant-constraints #-} {-# OPTIONS_GHC -Wno-redundant-constraints #-}
{-# OPTIONS_GHC -Wwarn #-}
module Handler.Utils.ExamSpec (spec) where module Handler.Utils.ExamSpec (spec) where
@ -103,7 +102,7 @@ spec = do
describe "examAutoOccurrence" $ do describe "examAutoOccurrence" $ do
describe "Surname" $ testWithRule ExamRoomSurname describe "Surname" $ testWithRule ExamRoomSurname
describe "Matriculation" $ testWithRule ExamRoomMatriculation describe "Matriculation" $ testWithRule ExamRoomMatriculation
-- TODO test with ExamRoomManual, ExamRoomFifo, (ExamRoomSurname), (ExamRoomMatriculation), ExamRoomRandom describe "Random" $ testWithRule ExamRoomRandom
where where
testWithRule :: ExamOccurrenceRule -> Spec testWithRule :: ExamOccurrenceRule -> Spec
testWithRule rule = testWithRule rule =
@ -150,6 +149,7 @@ spec = do
-- is a nullResult justified? -- is a nullResult justified?
Nothing -> pure () Nothing -> pure ()
{- {-
-- disabled for now, probably not correct with the current implementation
myAnnotate "unjustified nullResult" myAnnotate "unjustified nullResult"
$ shouldSatisfy (rule, userProperties, occurrences) $ uncurry3 isNullResultJustified $ shouldSatisfy (rule, userProperties, occurrences) $ uncurry3 isNullResultJustified
-} -}
@ -252,7 +252,7 @@ spec = do
transformTag (length -> rangeLength) = case rule of transformTag (length -> rangeLength) = case rule of
ExamRoomMatriculation -> reverse . take rangeLength . reverse ExamRoomMatriculation -> reverse . take rangeLength . reverse
_rule -> take rangeLength _rule -> take rangeLength
_otherwise -> False _otherwise -> (rule /= ExamRoomSurname) && (rule /= ExamRoomMatriculation)
{- {-
-- | Is mapping impossible? -- | Is mapping impossible?
isNullResultJustified :: ExamOccurrenceRule isNullResultJustified :: ExamOccurrenceRule