Revision 2c9fa1ff test/ganeti.ht_unittest.py

b/test/ganeti.ht_unittest.py
1 1
#!/usr/bin/python
2 2
#
3 3

  
4
# Copyright (C) 2011 Google Inc.
4
# Copyright (C) 2011, 2012 Google Inc.
5 5
#
6 6
# This program is free software; you can redistribute it and/or modify
7 7
# it under the terms of the GNU General Public License as published by
......
59 59
      self.assertFalse(ht.TInt(val))
60 60

  
61 61
    for val in range(0, 100, 4):
62
      self.assertTrue(ht.TPositiveInt(val))
62
      self.assertTrue(ht.TNonNegativeInt(val))
63 63
      neg = -(val + 1)
64
      self.assertFalse(ht.TNonNegativeInt(neg))
64 65
      self.assertFalse(ht.TPositiveInt(neg))
65
      self.assertFalse(ht.TStrictPositiveInt(neg))
66 66

  
67
      self.assertFalse(ht.TNonNegativeInt(0.1 + val))
67 68
      self.assertFalse(ht.TPositiveInt(0.1 + val))
68
      self.assertFalse(ht.TStrictPositiveInt(0.1 + val))
69 69

  
70 70
    for val in [0, 0.1, 0.9, -0.3]:
71
      self.assertFalse(ht.TStrictPositiveInt(val))
71
      self.assertFalse(ht.TPositiveInt(val))
72 72

  
73 73
    for val in range(1, 100, 4):
74
      self.assertTrue(ht.TStrictPositiveInt(val))
75
      self.assertFalse(ht.TStrictPositiveInt(0.1 + val))
74
      self.assertTrue(ht.TPositiveInt(val))
75
      self.assertFalse(ht.TPositiveInt(0.1 + val))
76 76

  
77 77
  def testFloat(self):
78 78
    for val in [-100.21, -3.0, 0.0, 16.12, 128.3433, 923874.928]:

Also available in: Unified diff