Make test produce fewer false negatives
This commit is contained in:
parent
0c1c647189
commit
88b9110865
@ -163,7 +163,7 @@ spec = withApp . describe "Submission distribution" $ do
|
||||
distributionExample
|
||||
(return [ (n, loads) | n <- ns' ])
|
||||
(\subs corrs -> do
|
||||
tutSubmissions <- liftIO $ getRandomR (1,500)
|
||||
tutSubmissions <- liftIO $ getRandomR (1,50)
|
||||
subs' <- liftIO $ shuffleM subs
|
||||
forM_ (take tutSubmissions subs') $ \(Entity subId Submission{..}) -> do
|
||||
Entity _ SheetCorrector{..} <- liftIO $ uniform corrs
|
||||
@ -179,10 +179,8 @@ spec = withApp . describe "Submission distribution" $ do
|
||||
(\result -> do
|
||||
let countResult = Map.map Set.size result
|
||||
countResult' = Map.mapKeysWith (+) (fmap $ \SheetCorrector{..} -> (fromSqlKey sheetCorrectorUser, byProportion sheetCorrectorLoad)) countResult
|
||||
tutSubIds' <- liftIO $ readTVarIO tutSubIds
|
||||
|
||||
countResult' `shouldNotSatisfy` Map.member Nothing
|
||||
countResult' `shouldSatisfy` all (\(Just (corr, prop), subsSet) -> fromIntegral subsSet <= max (50 * prop) (maybe 0 (fromIntegral . Set.size) $ tutSubIds' !? toSqlKey corr)) . Map.toList
|
||||
countResult' `shouldSatisfy` all (\(Just (corr, prop), subsSet) -> fromIntegral subsSet == 50 * prop) . Map.toList
|
||||
|
||||
-- -- Does not currently work, because `User`s are reused within `distributionExample`, so submissions end up having more associated course-tutors, because the same user might be a member of a tutorial created for another submission
|
||||
--
|
||||
|
||||
Loading…
Reference in New Issue
Block a user