ViewVC Help
View File | Revision Log | Show Annotations | Download File | Root Listing
root/radiance/ray/test/py_tests/test_lam.py
Revision: 1.3
Committed: Thu Mar 10 01:49:56 2016 UTC (8 years, 2 months ago) by schorsch
Content type: text/x-python
Branch: MAIN
Changes since 1.2: +10 -4 lines
Log Message:
SCons build system learns about platform architecture

File Contents

# User Rev Content
1 schorsch 1.1
2     import os
3     import math
4     import string
5     import unittest
6    
7     from unit_tools import support
8     from unit_tools import lcompare
9    
10 schorsch 1.3 _bindir = None
11    
12 schorsch 1.1 class LamTestCase(unittest.TestCase):
13     def setUp(self):
14 schorsch 1.3 if _bindir:
15     self.oldpath = os.environ['PATH']
16     os.environ['PATH'] = _bindir
17 schorsch 1.1
18     def tearDown(self):
19 schorsch 1.3 if _bindir:
20     os.environ['PATH'] = self.oldpath
21 schorsch 1.1
22     def test_lam(self):
23     dat_de = support.datafile('lam_de.dat')
24     dat_en = support.datafile('lam_en.dat')
25 schorsch 1.2 cmd = 'rlam -t: "%s" "%s"' % (dat_de, dat_en)
26 schorsch 1.1 raw = os.popen(cmd).read()
27     result = map(string.split,string.split(raw,'\n'))
28     expect = [
29     ['eins:one'],
30     ['zwei:two'],
31     ['drei:three'],
32     ['vier:four'],
33     ['fuenf:five'],
34     ]
35     try: lcompare.llcompare(result, expect, ignore_empty=1)
36     except lcompare.error, e:
37     self.fail('%s [%s]' % (str(e),cmd))
38    
39 schorsch 1.3 def main(bindir=None):
40     global _bindir
41     _bindir=bindir
42 schorsch 1.1 support.run_case(LamTestCase)
43    
44     if __name__ == '__main__':
45     main()
46    
47     # vi: set ts=4 sw=4 :