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.2 |
_bindir = None |
11 |
|
|
|
12 |
schorsch |
1.1 |
class XformTestCase(unittest.TestCase): |
13 |
|
|
def setUp(self): |
14 |
schorsch |
1.2 |
if _bindir: |
15 |
|
|
self.oldpath = os.environ['PATH'] |
16 |
|
|
os.environ['PATH'] = _bindir |
17 |
schorsch |
1.1 |
|
18 |
|
|
def tearDown(self): |
19 |
schorsch |
1.2 |
if _bindir: |
20 |
|
|
os.environ['PATH'] = self.oldpath |
21 |
schorsch |
1.1 |
|
22 |
schorsch |
1.2 |
def test_xform_e_s(self): |
23 |
schorsch |
1.1 |
cmd = 'xform -e -s 3.14159 "%s"' % support.datafile('xform_1.dat') |
24 |
|
|
result = lcompare.split_rad(os.popen(cmd).read()) |
25 |
|
|
expect = lcompare.split_radfile(support.datafile('xform_res1.dat')) |
26 |
|
|
try: lcompare.llcompare(result, expect, ignore_empty=1) |
27 |
|
|
except lcompare.error, e: |
28 |
|
|
self.fail('%s [%s]' % (str(e),cmd)) |
29 |
|
|
|
30 |
|
|
|
31 |
schorsch |
1.2 |
def test_xform_e_mx(self): |
32 |
schorsch |
1.1 |
cmd = 'xform -e -mx "%s"' % support.datafile('xform_2.dat') |
33 |
|
|
result = lcompare.split_rad(os.popen(cmd).read()) |
34 |
|
|
expect = lcompare.split_radfile(support.datafile('xform_res2.dat')) |
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.2 |
def main(bindir=None): |
40 |
|
|
global _bindir |
41 |
|
|
_bindir=bindir |
42 |
schorsch |
1.1 |
support.run_case(XformTestCase) |
43 |
|
|
|
44 |
|
|
if __name__ == '__main__': |
45 |
|
|
main() |
46 |
|
|
|
47 |
|
|
# vi: set ts=4 sw=4 : |