ViewVC Help
View File | Revision Log | Show Annotations | Download File | Root Listing
root/radiance/ray/test/py_tests/test_ttyimage.py
Revision: 1.1
Committed: Sun Dec 7 20:40:51 2003 UTC (20 years, 4 months ago) by schorsch
Content type: text/x-python
Branch: MAIN
CVS Tags: rad3R6, rad3R6P1
Log Message:
First attempt at testing framework.

File Contents

# Content
1
2
3 import os
4 import math
5 import string
6 import unittest
7
8 from unit_tools import support
9 from unit_tools import lcompare
10
11 class TtyimageTestCase(unittest.TestCase):
12 def setUp(self):
13 self.oldpath = os.environ['PATH']
14 os.environ['PATH'] = os.path.abspath(support.BINDIR)
15
16 def tearDown(self):
17 os.environ['PATH'] = self.oldpath
18
19 def test_ttyimage(self):
20 '''We just to point checks here'''
21 picfile = support.datafile('Earth128.pic')
22 cmd = 'ttyimage "%s"' % picfile
23 res0 = os.popen(cmd).read()
24 result = map(string.split,string.split(res0, '\n'))
25 expect = [[0,
26 ['################################################################'
27 '################################################################']],
28 [7,
29 ['#########################@%,,.?++&%%###$&###############@&:.....'
30 '.......,,.......,,.,,;..+?,...,.:*+.:&#########@################']],
31 [23,
32 ['.......;,:.....,++*+?++++;+;:,::,..,,;+;;+...................,;,'
33 '..,:;+::+;;:;;:;;;;;:;+;;;;;;;;;:;+;;;;;%%$@%$&%#?.....,#%......']],
34 [54,
35 ['................................,,,.......................*%?$@#'
36 '###########@$%%%;.........:?:.....,?+;:....;,...................']],
37 [99,
38 ['.....................................+++........................'
39 '................................................................']],
40 ]
41
42 for l in expect:
43 self.assertEqual(result[l[0]], l[1],
44 '%s : %s != %s [line %s]' % (cmd,result[l[0]],l[1], l[0]))
45
46 def main():
47 support.run_case(TtyimageTestCase)
48
49 if __name__ == '__main__':
50 main()
51
52 # vi: set ts=4 sw=4 :