blob: c39083a728d641c14f7650ab1e07a1acdc61f7ff (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
|
{-# LANGUAGE TypeSynonymInstances, FlexibleInstances, StandaloneDeriving #-}
module Thermoprint.Server.QueueSpec (spec) where
import Test.Hspec
import Test.Hspec.QuickCheck (prop)
import Thermoprint.Server.Queue
import Thermoprint.Server.Database
import Thermoprint.API hiding (JobId)
import Test.QuickCheck.Arbitrary
import Test.QuickCheck.Gen
import Test.QuickCheck.Modifiers
deriving instance (Eq PrintingError)
deriving instance (Eq Queue)
instance Arbitrary Queue where
arbitrary = Queue <$> arbitrary <*> arbitrary <*> arbitrary
instance Arbitrary QueueEntry where
arbitrary = QueueEntry <$> arbitrary <*> arbitrary
instance Arbitrary PrintingError where
arbitrary = oneof [ return (IOError "dummy")
]
instance Arbitrary JobId where
arbitrary = castId . getNonNegative <$> (arbitrary :: Gen (NonNegative Integer))
spec :: Spec
spec = do
prop "prop_zipper" $ \queue -> queue == toZipper (fromZipper queue)
|