From 2ee7f41d0519873b55add44502782e6946066506 Mon Sep 17 00:00:00 2001 From: Wolfgang Witt Date: Fri, 26 Feb 2021 10:44:06 +0100 Subject: [PATCH] chore(test): fix type errors + add more surnames --- test/Handler/Utils/ExamSpec.hs | 11 +++++++---- 1 file changed, 7 insertions(+), 4 deletions(-) diff --git a/test/Handler/Utils/ExamSpec.hs b/test/Handler/Utils/ExamSpec.hs index c1e078334..30cb9b883 100644 --- a/test/Handler/Utils/ExamSpec.hs +++ b/test/Handler/Utils/ExamSpec.hs @@ -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)