Revision 596470db test/hs/Test/Ganeti/Objects.hs

b/test/hs/Test/Ganeti/Objects.hs
242 242
  mac_prefix <- genMaybe genName
243 243
  net <- arbitrary
244 244
  net6 <- genMaybe genIp6Net
245
  gateway <- genMaybe arbitrary
246
  gateway6 <- genMaybe genIp6Addr
247
  res <- liftM Just (genBitString $ netmask2NumHosts netmask)
248
  ext_res <- liftM Just (genBitString $ netmask2NumHosts netmask)
249 245
  uuid <- arbitrary
250
  let n = Network name mac_prefix (Just $ Ip4Network net netmask) net6 gateway
251
          gateway6 res ext_res uuid 0 Set.empty
246
  res <- liftM Just (genBitString $ netmask2NumHosts netmask)
247
  ext_res <- liftM Just (genZeroedBitString $ netmask2NumHosts netmask)
248
  let n = Network name mac_prefix (Just $ Ip4Network net netmask) net6 Nothing
249
          Nothing res ext_res uuid 0 Set.empty
252 250
  return n
253 251

  
254 252
-- | Generate an arbitrary string consisting of '0' and '1' of the given length.
255 253
genBitString :: Int -> Gen String
256 254
genBitString len = vectorOf len (elements "01")
257 255

  
256
genZeroedBitString :: Int -> Gen String
257
genZeroedBitString len = vectorOf len (elements "0")
258

  
258 259
-- | Generate an arbitrary string consisting of '0' and '1' of the maximum given
259 260
-- length.
260 261
genBitStringMaxLen :: Int -> Gen String
......
375 376
              \for net in decoded:\n\
376 377
              \  a = network.Network(net)\n\
377 378
              \  if net.network:\n\
378
              \    encoded.append((a._GetFreeCount(), a._GetReservedCount(), \\\n\
379
              \    encoded.append((a._GetFreeCount(), \\\n\
380
              \                   a._GetReservedCount(), \\\n\
379 381
              \                   net.ToDict()))\n\
380 382
              \  else:\n\
381 383
              \    encoded.append((-1, -1, \\\n\

Also available in: Unified diff