chore(test): also test for equal length of matriculation description
This commit is contained in:
parent
ad67c2e0e2
commit
d5b1203d53
@ -225,28 +225,36 @@ spec = do
|
|||||||
where
|
where
|
||||||
descriptionValid:: ExamOccurrenceId -> ExamOccurrenceMappingDescription -> Bool
|
descriptionValid:: ExamOccurrenceId -> ExamOccurrenceMappingDescription -> Bool
|
||||||
descriptionValid roomId description
|
descriptionValid roomId description
|
||||||
= endAfterStart description && all (all $ noDirectOverlap description) (Map.delete roomId examOccurrenceMappingMapping)
|
= endAfterStart description
|
||||||
|
&& all (all $ noDirectOverlap description) (Map.delete roomId examOccurrenceMappingMapping)
|
||||||
endAfterStart :: ExamOccurrenceMappingDescription -> Bool
|
endAfterStart :: ExamOccurrenceMappingDescription -> Bool
|
||||||
endAfterStart
|
endAfterStart
|
||||||
ExamOccurrenceMappingRange {eaomrStart=(pack . map CI.foldedCase -> start), eaomrEnd=(pack . map CI.foldedCase -> end)}
|
ExamOccurrenceMappingRange {eaomrStart=(pack . map CI.foldedCase -> start), eaomrEnd=(pack . map CI.foldedCase -> end)}
|
||||||
= RFC5051.compareUnicode start end /= GT
|
= RFC5051.compareUnicode start end /= GT
|
||||||
endAfterStart ExamOccurrenceMappingSpecial {} = True
|
endAfterStart ExamOccurrenceMappingSpecial {} = True
|
||||||
|
-- also check for equal length with ExamRoomMatriculation
|
||||||
noDirectOverlap :: ExamOccurrenceMappingDescription -> ExamOccurrenceMappingDescription -> Bool
|
noDirectOverlap :: ExamOccurrenceMappingDescription -> ExamOccurrenceMappingDescription -> Bool
|
||||||
noDirectOverlap
|
noDirectOverlap
|
||||||
ExamOccurrenceMappingRange {eaomrStart=(pack . map CI.foldedCase -> s0), eaomrEnd=(pack . map CI.foldedCase -> e0)}
|
ExamOccurrenceMappingRange {eaomrStart=cs0@(pack . map CI.foldedCase -> s0), eaomrEnd=ce0@(pack . map CI.foldedCase -> e0)}
|
||||||
ExamOccurrenceMappingRange {eaomrStart=(pack . map CI.foldedCase -> s1), eaomrEnd=(pack . map CI.foldedCase -> e1)}
|
ExamOccurrenceMappingRange {eaomrStart=cs1@(pack . map CI.foldedCase -> s1), eaomrEnd=ce1@(pack . map CI.foldedCase -> e1)}
|
||||||
= (RFC5051.compareUnicode s0 s1 == LT && RFC5051.compareUnicode e0 s1 == LT)
|
= equalLengthForMatriculation [cs0, ce0, cs1, ce1]
|
||||||
|| (RFC5051.compareUnicode s0 e1 == GT && RFC5051.compareUnicode e0 s1 == GT)
|
&& ((RFC5051.compareUnicode s0 s1 == LT && RFC5051.compareUnicode e0 s1 == LT)
|
||||||
|
|| (RFC5051.compareUnicode s0 e1 == GT && RFC5051.compareUnicode e0 s1 == GT))
|
||||||
noDirectOverlap
|
noDirectOverlap
|
||||||
ExamOccurrenceMappingRange {eaomrStart, eaomrEnd}
|
ExamOccurrenceMappingRange {eaomrStart, eaomrEnd}
|
||||||
ExamOccurrenceMappingSpecial {eaomrSpecial}
|
ExamOccurrenceMappingSpecial {eaomrSpecial}
|
||||||
= noDirectOverlapRangeSpecial eaomrStart eaomrEnd eaomrSpecial
|
= equalLengthForMatriculation [eaomrStart, eaomrEnd, eaomrSpecial]
|
||||||
|
&& noDirectOverlapRangeSpecial eaomrStart eaomrEnd eaomrSpecial
|
||||||
noDirectOverlap
|
noDirectOverlap
|
||||||
ExamOccurrenceMappingSpecial {eaomrSpecial}
|
ExamOccurrenceMappingSpecial {eaomrSpecial}
|
||||||
ExamOccurrenceMappingRange {eaomrStart, eaomrEnd}
|
ExamOccurrenceMappingRange {eaomrStart, eaomrEnd}
|
||||||
= noDirectOverlapRangeSpecial eaomrStart eaomrEnd eaomrSpecial
|
= equalLengthForMatriculation [eaomrStart, eaomrEnd, eaomrSpecial]
|
||||||
noDirectOverlap ExamOccurrenceMappingSpecial {eaomrSpecial=s1} ExamOccurrenceMappingSpecial {eaomrSpecial=s2}
|
&& noDirectOverlapRangeSpecial eaomrStart eaomrEnd eaomrSpecial
|
||||||
= s1 /= s2
|
noDirectOverlap ExamOccurrenceMappingSpecial {eaomrSpecial=s0} ExamOccurrenceMappingSpecial {eaomrSpecial=s1}
|
||||||
|
= equalLengthForMatriculation [s0, s1] && s0 /= s1
|
||||||
|
equalLengthForMatriculation :: [[CI Char]] -> Bool
|
||||||
|
equalLengthForMatriculation [] = True
|
||||||
|
equalLengthForMatriculation (h:t) = (rule /= ExamRoomMatriculation) || all (== Text.length h) (Text.length <$> t)
|
||||||
noDirectOverlapRangeSpecial :: [CI Char] -> [CI Char] -> [CI Char] -> Bool
|
noDirectOverlapRangeSpecial :: [CI Char] -> [CI Char] -> [CI Char] -> Bool
|
||||||
noDirectOverlapRangeSpecial
|
noDirectOverlapRangeSpecial
|
||||||
(pack . map CI.foldedCase -> start)
|
(pack . map CI.foldedCase -> start)
|
||||||
|
|||||||
Reference in New Issue
Block a user