root/waveletUnitTest.py

Revision 51, 1.2 kB (checked in by steve, 1 year ago)

GPL'ness added

Line 
1 #!/usr/bin/env python
2 # encoding: utf-8
3 """
4 waveletUnitTest.py
5
6 Created by Shu Ning Bian on 2007-09-23.
7 Copyright (c) 2007 . All rights reserved.
8 Licensed for distribution under the GPL version 2, check COPYING for details.
9 """
10
11 import unittest
12 import wavelet
13
14 class waveletUnitTest(unittest.TestCase):
15         def setUp(self):
16                 """
17                 steve@solaris:~/code/mactorii$ md5sum blueships.jpg
18                 9c5e36768e6dad37b17244eb54ca9b9d  blueships.jpg
19                 steve@solaris:~/code/mactorii$ md5sum hiero.jpg
20                 1aa200df65ff0d99ffc2b9543963bed4  hiero.jpg
21                 """
22                 self.wi=[]
23                 self.wi.append(wavelet.open("bluexmas2k2.jpg"))
24                 self.wi.append(wavelet.open("hiero.jpg"))
25                
26         def testSignature(self):
27                 return
28                 """Checking signatures are still correct"""
29                 hashes = [
30                         [891130499,380051862,687850410],
31                         [-2134815841,-775538075,-627883134]
32                         ]
33                 for i in xrange(len(self.wi)):
34                         sig = self.wi[i].signature()
35                         for j in xrange(3):
36                                 s = sig[j]
37                                 h = hash(tuple(s))
38                                 assert  h == hashes[i][j], "bad hash. expected %d got %d"%(hashes[i][j], h)
39        
40         def testCleanup(self):
41                 return
42                 """Make sure the cleanup function is still working"""
43                 for i in xrange(len(self.wi)):
44                         self.wi[i].signature()
45                         self.wi[i].cleanup()
46                
47                 self.testSignature()
48                                        
49 if __name__ == '__main__':
50         unittest.main()
Note: See TracBrowser for help on using the browser.