Revision a3f02317 htest/Test/Ganeti/Types.hs

b/htest/Test/Ganeti/Types.hs
99 99

  
100 100
$(genArbitrary ''ExportMode)
101 101

  
102
$(genArbitrary ''IAllocatorTestDir)
103

  
104
$(genArbitrary ''IAllocatorMode)
105

  
102 106
-- * Properties
103 107

  
104 108
prop_AllocPolicy_serialisation :: AllocPolicy -> Property
......
212 216
prop_ExportMode_serialisation :: ExportMode -> Property
213 217
prop_ExportMode_serialisation = testSerialisation
214 218

  
219
-- | Test 'IAllocatorTestDir' serialisation.
220
prop_IAllocatorTestDir_serialisation :: IAllocatorTestDir -> Property
221
prop_IAllocatorTestDir_serialisation = testSerialisation
222

  
223
-- | Test 'IAllocatorMode' serialisation.
224
prop_IAllocatorMode_serialisation :: IAllocatorMode -> Property
225
prop_IAllocatorMode_serialisation = testSerialisation
226

  
227
-- | Tests equivalence with Python, based on Constants.hs code.
228
case_IAllocatorMode_pyequiv :: Assertion
229
case_IAllocatorMode_pyequiv = do
230
  let all_py_codes = sort C.validIallocatorModes
231
      all_hs_codes = sort $ map Types.iAllocatorModeToRaw [minBound..maxBound]
232
  assertEqual "for IAllocatorMode equivalence" all_py_codes all_hs_codes
233

  
215 234
testSuite "Types"
216 235
  [ 'prop_AllocPolicy_serialisation
217 236
  , 'prop_DiskTemplate_serialisation
......
236 255
  , 'prop_InstCreateMode_serialisation
237 256
  , 'prop_RebootType_serialisation
238 257
  , 'prop_ExportMode_serialisation
258
  , 'prop_IAllocatorTestDir_serialisation
259
  , 'prop_IAllocatorMode_serialisation
260
  , 'case_IAllocatorMode_pyequiv
239 261
  ]

Also available in: Unified diff