diff options
author | Gregor Kleen <gkleen@yggdrasil.li> | 2016-02-11 22:05:12 +0000 |
---|---|---|
committer | Gregor Kleen <gkleen@yggdrasil.li> | 2016-02-11 22:05:12 +0000 |
commit | 7de330ea4fa17a0e1ba2eb33e4440545dc6be93a (patch) | |
tree | a70bd209ab69883964f8ba1b3c1667b13580758c /server/test/Thermoprint | |
parent | a86e55bbcc6d5b23ab11312d3ca94a745bea5ed9 (diff) | |
download | thermoprint-7de330ea4fa17a0e1ba2eb33e4440545dc6be93a.tar thermoprint-7de330ea4fa17a0e1ba2eb33e4440545dc6be93a.tar.gz thermoprint-7de330ea4fa17a0e1ba2eb33e4440545dc6be93a.tar.bz2 thermoprint-7de330ea4fa17a0e1ba2eb33e4440545dc6be93a.tar.xz thermoprint-7de330ea4fa17a0e1ba2eb33e4440545dc6be93a.zip |
Test for zipper morphisms
Diffstat (limited to 'server/test/Thermoprint')
-rw-r--r-- | server/test/Thermoprint/Server/QueueSpec.hs | 34 |
1 files changed, 34 insertions, 0 deletions
diff --git a/server/test/Thermoprint/Server/QueueSpec.hs b/server/test/Thermoprint/Server/QueueSpec.hs new file mode 100644 index 0000000..fd45e1b --- /dev/null +++ b/server/test/Thermoprint/Server/QueueSpec.hs | |||
@@ -0,0 +1,34 @@ | |||
1 | {-# LANGUAGE TypeSynonymInstances, FlexibleInstances, StandaloneDeriving #-} | ||
2 | |||
3 | module Thermoprint.Server.QueueSpec (spec) where | ||
4 | |||
5 | import Test.Hspec | ||
6 | import Test.Hspec.QuickCheck (prop) | ||
7 | |||
8 | import Thermoprint.Server.Queue | ||
9 | import Thermoprint.Server.Database | ||
10 | import Thermoprint.API hiding (JobId) | ||
11 | |||
12 | import Test.QuickCheck.Arbitrary | ||
13 | import Test.QuickCheck.Gen | ||
14 | import Test.QuickCheck.Modifiers | ||
15 | |||
16 | deriving instance (Eq PrintingError) | ||
17 | deriving instance (Eq Queue) | ||
18 | |||
19 | instance Arbitrary Queue where | ||
20 | arbitrary = Queue <$> arbitrary <*> arbitrary <*> arbitrary | ||
21 | |||
22 | instance Arbitrary QueueEntry where | ||
23 | arbitrary = QueueEntry <$> arbitrary <*> arbitrary | ||
24 | |||
25 | instance Arbitrary PrintingError where | ||
26 | arbitrary = oneof [ return UnknownError | ||
27 | ] | ||
28 | |||
29 | instance Arbitrary JobId where | ||
30 | arbitrary = castId . getNonNegative <$> (arbitrary :: Gen (NonNegative Integer)) | ||
31 | |||
32 | spec :: Spec | ||
33 | spec = do | ||
34 | prop "prop_zipper" $ \queue -> queue == toZipper (fromZipper queue) | ||