Revision 63b068c1 htest/Test/Ganeti/HTools/Types.hs
b/htest/Test/Ganeti/HTools/Types.hs | ||
---|---|---|
41 | 41 |
import Test.QuickCheck |
42 | 42 |
|
43 | 43 |
import Control.Applicative |
44 |
import qualified Text.JSON as J |
|
45 | 44 |
|
46 | 45 |
import Test.Ganeti.TestHelper |
47 | 46 |
import Test.Ganeti.TestCommon |
... | ... | |
128 | 127 |
-- * Test cases |
129 | 128 |
|
130 | 129 |
prop_AllocPolicy_serialisation :: Types.AllocPolicy -> Property |
131 |
prop_AllocPolicy_serialisation apol = |
|
132 |
case J.readJSON (J.showJSON apol) of |
|
133 |
J.Ok p -> p ==? apol |
|
134 |
J.Error s -> failTest $ "Failed to deserialise: " ++ s |
|
130 |
prop_AllocPolicy_serialisation = testSerialisation |
|
135 | 131 |
|
136 | 132 |
prop_DiskTemplate_serialisation :: Types.DiskTemplate -> Property |
137 |
prop_DiskTemplate_serialisation dt = |
|
138 |
case J.readJSON (J.showJSON dt) of |
|
139 |
J.Ok p -> p ==? dt |
|
140 |
J.Error s -> failTest $ "Failed to deserialise: " ++ s |
|
133 |
prop_DiskTemplate_serialisation = testSerialisation |
|
141 | 134 |
|
142 | 135 |
prop_ISpec_serialisation :: Types.ISpec -> Property |
143 |
prop_ISpec_serialisation ispec = |
|
144 |
case J.readJSON (J.showJSON ispec) of |
|
145 |
J.Ok p -> p ==? ispec |
|
146 |
J.Error s -> failTest $ "Failed to deserialise: " ++ s |
|
136 |
prop_ISpec_serialisation = testSerialisation |
|
147 | 137 |
|
148 | 138 |
prop_IPolicy_serialisation :: Types.IPolicy -> Property |
149 |
prop_IPolicy_serialisation ipol = |
|
150 |
case J.readJSON (J.showJSON ipol) of |
|
151 |
J.Ok p -> p ==? ipol |
|
152 |
J.Error s -> failTest $ "Failed to deserialise: " ++ s |
|
139 |
prop_IPolicy_serialisation = testSerialisation |
|
153 | 140 |
|
154 | 141 |
prop_EvacMode_serialisation :: Types.EvacMode -> Property |
155 |
prop_EvacMode_serialisation em = |
|
156 |
case J.readJSON (J.showJSON em) of |
|
157 |
J.Ok p -> p ==? em |
|
158 |
J.Error s -> failTest $ "Failed to deserialise: " ++ s |
|
142 |
prop_EvacMode_serialisation = testSerialisation |
|
159 | 143 |
|
160 | 144 |
prop_opToResult :: Types.OpResult Int -> Bool |
161 | 145 |
prop_opToResult op = |
Also available in: Unified diff