ViewVC Help
View File | Revision Log | Show Annotations | Download File | Root Listing
root/radiance/ray/test/py_tests/test_genbeads.py
Revision: 1.3
Committed: Mon Mar 28 17:48:43 2016 UTC (8 years, 1 month ago) by schorsch
Content type: text/x-python
Branch: MAIN
CVS Tags: HEAD
Changes since 1.2: +0 -0 lines
State: FILE REMOVED
Error occurred while calculating annotation data.
Log Message:
Refactoring of test suite, use independently of SCons and with Py2.7 or 3.x.

File Contents

# Content
1 from __future__ import print_function
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 _bindir = None
12
13 class GenbeadsTestCase(unittest.TestCase):
14 def setUp(self):
15 if _bindir:
16 self.oldpath = os.environ['PATH']
17 os.environ['PATH'] = _bindir
18
19 def tearDown(self):
20 if _bindir:
21 os.environ['PATH'] = self.oldpath
22
23 def test_genbeads(self):
24 cmd = 'genbeads mymat myname 0 0 0 1 1 1 2 0 0 0 2 0 .1 .4'
25 raw = os.popen(cmd).read()
26 result = map(string.split,string.split(raw,'\n'))
27 expect = [['mymat', 'sphere', 'myname.0'], [0], [0],
28 [4, 0, 0, 0, 0.1],
29 ['mymat', 'sphere', 'myname.1'], [0], [0],
30 [4, 0.36, 0.04, 0.104, 0.1],
31 ['mymat', 'sphere', 'myname.2'], [0], [0],
32 [4, 0.651440715413, 0.167781092737, 0.365893348046, 0.1],
33 ['mymat', 'sphere', 'myname.3'], [0], [0],
34 [4, 0.844350245496, 0.366600314978, 0.655866088042, 0.1],
35 ['mymat', 'sphere', 'myname.4'], [0], [0],
36 [4, 0.960791445178, 0.643185551339, 0.897901825177, 0.1],
37 ]
38 try: lcompare.llcompare(result, expect, ignore_empty=1)
39 except lcompare.error, e:
40 self.fail('%s [%s]' % (str(e),cmd))
41
42
43 def main(bindir=None):
44 global _bindir
45 _bindir=bindir
46 support.run_case(GenbeadsTestCase)
47
48 if __name__ == '__main__':
49 main()
50
51 # vi: set ts=4 sw=4 :