:clown-face: fixed a test

This commit is contained in:
Nikolaj
2024-10-21 10:17:40 +02:00
parent 5a9e4d675b
commit 849ce2858f
2 changed files with 9 additions and 6 deletions

View File

@ -1,3 +1,4 @@
{-# LANGUAGE InstanceSigs #-}
module SPC module SPC
( -- * SPC startup ( -- * SPC startup
SPC, SPC,
@ -129,7 +130,6 @@ data SPCState = SPCState
spcJobsDone :: [(JobId, JobDoneReason)], spcJobsDone :: [(JobId, JobDoneReason)],
spcJobCounter :: JobId, spcJobCounter :: JobId,
spcWorkers :: [(WorkerName, Worker)] spcWorkers :: [(WorkerName, Worker)]
-- TODO: you will need to add more fields.
} }
-- | The monad in which the main SPC thread runs. This is a state -- | The monad in which the main SPC thread runs. This is a state
@ -137,6 +137,7 @@ data SPCState = SPCState
newtype SPCM a = SPCM (SPCState -> IO (a, SPCState)) newtype SPCM a = SPCM (SPCState -> IO (a, SPCState))
instance Functor SPCM where instance Functor SPCM where
fmap :: (a -> b) -> SPCM a -> SPCM b
fmap = liftM fmap = liftM
instance Applicative SPCM where instance Applicative SPCM where
@ -230,6 +231,8 @@ handleMsg c = do
spcJobsDone = spcJobsDone =
(jobid, Done) : spcJobsDone state (jobid, Done) : spcJobsDone state
} }
Nothing -> pure ()
_ -> pure ()
deleteJob :: JobId -> [(JobId, (Job, Worker))] -> [(JobId, (Job, Worker))] deleteJob :: JobId -> [(JobId, (Job, Worker))] -> [(JobId, (Job, Worker))]
deleteJob jobid list = deleteJob jobid list =

View File

@ -33,6 +33,6 @@ tests =
testCase "worker-add-2-fail" $ do testCase "worker-add-2-fail" $ do
spc <- startSPC spc <- startSPC
_ <- workerAdd spc "BD-1" _ <- workerAdd spc "BD-1"
w <- workerAdd spc "R5-D4" w <- workerAdd spc "BD-1"
isRight w @?= False isRight w @?= False
] ]