ViewVC Help
View File | Revision Log | Show Annotations | Download File | Root Listing
root/radiance/ray/test/py_tests/test_ttyimage.py
Revision: 1.2
Committed: Thu Feb 10 16:36:54 2005 UTC (19 years, 2 months ago) by schorsch
Content type: text/x-python
Branch: MAIN
CVS Tags: rad3R7P2, rad4R2P2, rad4R2P1, rad3R7P1, rad4R2, rad4R1, rad4R0, rad3R8, rad3R9, rad5R0
Changes since 1.1: +1 -1 lines
Log Message:
Updated for changed executable names.

File Contents

# User Rev Content
1 schorsch 1.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 schorsch 1.2 '''We just do a few spot checks here'''
21 schorsch 1.1 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 :