chore(test): fix type errors + add more surnames

This commit is contained in:
Wolfgang Witt 2021-02-26 10:44:06 +01:00 committed by Wolfgang Witt
parent d5b1203d53
commit 2ee7f41d05

View File

@ -136,7 +136,7 @@ spec = do
case maybeMapping of
(Just occurrenceMapping) -> do
-- mapping is a valid description
myAnnotate "invalid mapping description" $ shouldSatisfy occurrenceMapping validRangeDescription
myAnnotate "invalid mapping description" $ shouldSatisfy (rule, occurrenceMapping) $ uncurry validRangeDescription
-- every (relevant) user got assigned a room
let foldFn :: (UserId, Maybe ExamOccurrenceId) -> Bool -> Bool
foldFn _userMapping False = False
@ -196,6 +196,9 @@ spec = do
, "Lopez", "Lee", "Gonzalez", "Harris"
, "Clark", "Lewis", "Robinson", "Walker"
, "Perez", "Hall", "Young", "zu Allen", "Fu"
, "Meier", "Meyer", "Maier", "Mayer"
, "Meir", "Müller", "Schulze", "Schmitt"
, "FTB Modul", "Mártinèz", "zu Walker", "Schmidt"
, "Únîcòdé", "Ähm-Ümlaüte", "von Leerzeichen"
]
occurrenceMap :: Map UserId (Maybe ExamOccurrenceId) -> Map ExamOccurrenceId [UserId]
@ -219,8 +222,8 @@ spec = do
(Just capacity) -> length userIds <= fromIntegral capacity
|| all (isJust . snd) (Map.restrictKeys userProperties $ Set.fromList userIds)
-- | No range overlap for different rooms + end is always the greater value
validRangeDescription :: ExamOccurrenceMapping ExamOccurrenceId -> Bool
validRangeDescription ExamOccurrenceMapping {examOccurrenceMappingMapping}
validRangeDescription :: ExamOccurrenceRule -> ExamOccurrenceMapping ExamOccurrenceId -> Bool
validRangeDescription rule ExamOccurrenceMapping {examOccurrenceMappingMapping}
= all (\(roomId, ranges) -> all (descriptionValid roomId) ranges) $ Map.toAscList examOccurrenceMappingMapping
where
descriptionValid:: ExamOccurrenceId -> ExamOccurrenceMappingDescription -> Bool
@ -254,7 +257,7 @@ spec = do
= equalLengthForMatriculation [s0, s1] && s0 /= s1
equalLengthForMatriculation :: [[CI Char]] -> Bool
equalLengthForMatriculation [] = True
equalLengthForMatriculation (h:t) = (rule /= ExamRoomMatriculation) || all (== Text.length h) (Text.length <$> t)
equalLengthForMatriculation (h:t) = (rule /= ExamRoomMatriculation) || all (== length h) (length <$> t)
noDirectOverlapRangeSpecial :: [CI Char] -> [CI Char] -> [CI Char] -> Bool
noDirectOverlapRangeSpecial
(pack . map CI.foldedCase -> start)