1 |
# -*- coding: utf-8 -*- |
2 |
from __future__ import division, print_function, unicode_literals |
3 |
|
4 |
import unittest |
5 |
|
6 |
import testsupport as ts |
7 |
from pyradlib import lcompare |
8 |
from pyradlib.pyrad_proc import PIPE, Error, ProcMixin |
9 |
|
10 |
|
11 |
class RluxTestCase(unittest.TestCase, ProcMixin): |
12 |
|
13 |
def _runit(self, cmd, data): |
14 |
failmsg = None |
15 |
try: |
16 |
proc = self.call_one(cmd, 'test rlux', |
17 |
_in=PIPE, out=PIPE, universal_newlines=True) |
18 |
raw, err = proc.communicate(data) |
19 |
except Error as e: |
20 |
failmsg = str(e) |
21 |
if failmsg: |
22 |
self.fail(failmsg) |
23 |
return lcompare.split_rad(raw) |
24 |
|
25 |
def test_rlux(self): |
26 |
octfn = ts.datafile('corner', 'corner.oct') |
27 |
data = '''0.5 0.5 1.5 0 0 -1 |
28 |
0.3 0.7 0.5 0 0 -1 |
29 |
0.7 0.3 0.5 0 0 -1 |
30 |
0.5 0.5 0.5 0 1 0 |
31 |
0.5 0.5 0.5 -1 0 0 |
32 |
-1 0.5 0.5 1 0 0 |
33 |
0.5 2 0.5 0 -1 0 |
34 |
''' |
35 |
exp = [[37796.5481], [0], [37796.5481], [0], [0], [46062.1953], [0], []] |
36 |
cmd = ['rlux', octfn] |
37 |
resl = self._runit(cmd, data) |
38 |
lcompare.llcompare(resl, exp) |
39 |
|
40 |
|
41 |
|
42 |
# vi: set ts=4 sw=4 : |