1 __revision__ = "__FILE__ __REVISION__ __DATE__ __DEVELOPER__"
6 from SCons.Sig.TimeStamp import current, collect, signature, to_string, from_string
11 """A dummy object class that satisfies the interface
12 requirements of the TimeStamp class.
15 def __init__(self, value = 0):
18 def get_signature(self):
21 def get_timestamp(self):
25 class TimeStampTestCase(unittest.TestCase):
27 def test_current(self):
28 """Test deciding if an object is up-to-date
30 Simple comparison of different timestamp values.
32 o1 = my_obj(value = 111)
33 assert current(o1, 110)
34 assert current(o1, 111)
35 assert not current(o1, 112)
37 def test_collect(self):
38 """Test collecting a list of signatures into a new signature value
39 into a new timestamp value.
42 assert 111 == collect((111,))
43 assert 222 == collect((111, 222))
44 assert 333 == collect((333, 222, 111))
46 def test_signature(self):
47 """Test generating a signature"""
48 o1 = my_obj(value = 111)
49 assert 111 == signature(o1)
51 def test_to_string(self):
52 assert '111' == to_string(111)
54 def test_from_string(self):
55 assert 111 == from_string('111')
58 if __name__ == "__main__":
59 suite = unittest.makeSuite(TimeStampTestCase, 'test_')
60 if not unittest.TextTestRunner().run(suite).wasSuccessful():