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
|
distributionExample
|
||||||
(return [ (n, loads) | n <- ns' ])
|
(return [ (n, loads) | n <- ns' ])
|
||||||
(\subs corrs -> do
|
(\subs corrs -> do
|
||||||
tutSubmissions <- liftIO $ getRandomR (1,500)
|
tutSubmissions <- liftIO $ getRandomR (1,50)
|
||||||
subs' <- liftIO $ shuffleM subs
|
subs' <- liftIO $ shuffleM subs
|
||||||
forM_ (take tutSubmissions subs') $ \(Entity subId Submission{..}) -> do
|
forM_ (take tutSubmissions subs') $ \(Entity subId Submission{..}) -> do
|
||||||
Entity _ SheetCorrector{..} <- liftIO $ uniform corrs
|
Entity _ SheetCorrector{..} <- liftIO $ uniform corrs
|
||||||
@ -179,10 +179,8 @@ spec = withApp . describe "Submission distribution" $ do
|
|||||||
(\result -> do
|
(\result -> do
|
||||||
let countResult = Map.map Set.size result
|
let countResult = Map.map Set.size result
|
||||||
countResult' = Map.mapKeysWith (+) (fmap $ \SheetCorrector{..} -> (fromSqlKey sheetCorrectorUser, byProportion sheetCorrectorLoad)) countResult
|
countResult' = Map.mapKeysWith (+) (fmap $ \SheetCorrector{..} -> (fromSqlKey sheetCorrectorUser, byProportion sheetCorrectorLoad)) countResult
|
||||||
tutSubIds' <- liftIO $ readTVarIO tutSubIds
|
|
||||||
|
|
||||||
countResult' `shouldNotSatisfy` Map.member Nothing
|
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
|
-- -- 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
|
||||||
--
|
--
|
||||||
|
|||||||
Reference in New Issue
Block a user