ViewVC Help
View File | Revision Log | Show Annotations | Download File | Root Listing
root/radiance/ray/test/testcases/gen/test_genbeads.py
Revision: 1.1
Committed: Mon Mar 28 17:48:43 2016 UTC (9 years, 1 month ago) by schorsch
Content type: text/x-python
Branch: MAIN
CVS Tags: rad5R4, rad5R2, rad5R3, HEAD
Log Message:
Refactoring of test suite, use independently of SCons and with Py2.7 or 3.x.

File Contents

# Content
1 # -*- coding: utf-8 -*-
2 from __future__ import division, print_function, unicode_literals
3
4 import os
5 import unittest
6
7 from pyradlib import lcompare
8 from pyradlib.pyrad_proc import PIPE, Error, ProcMixin
9
10
11 class GenbeadsTestCase(unittest.TestCase, ProcMixin):
12
13 def test_genbeads(self):
14 cmdl = 'genbeads mymat myname 0 0 0 1 1 1 2 0 0 0 2 0 .1 .4'.split()
15 try:
16 proc = self.call_one(cmdl, 'call genbeads', out=PIPE,
17 universal_newlines=True)
18 raw = proc.stdout.read()
19 except Error as e:
20 self.fail('%s [%s]' % (str(e), self.qjoin(cmdl)))
21 finally:
22 proc.wait()
23 result = lcompare.split_rad(raw)
24 expect = [['mymat', 'sphere', 'myname.0'], [0], [0],
25 [4, 0, 0, 0, 0.1],
26 ['mymat', 'sphere', 'myname.1'], [0], [0],
27 [4, 0.36, 0.04, 0.104, 0.1],
28 ['mymat', 'sphere', 'myname.2'], [0], [0],
29 [4, 0.651440715413, 0.167781092737, 0.365893348046, 0.1],
30 ['mymat', 'sphere', 'myname.3'], [0], [0],
31 [4, 0.844350245496, 0.366600314978, 0.655866088042, 0.1],
32 ['mymat', 'sphere', 'myname.4'], [0], [0],
33 [4, 0.960791445178, 0.643185551339, 0.897901825177, 0.1],
34 ]
35 try: lcompare.llcompare(result, expect, ignore_empty=True)
36 except lcompare.error as e:
37 self.fail('%s [%s]' % (str(e), self.qjoin(cmdl)))
38
39
40 # vi: set ts=4 sw=4 :