| 1 |
schorsch |
1.2 |
from __future__ import print_function
|
| 2 |
schorsch |
1.1 |
|
| 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 |
schorsch |
1.2 |
_bindir = None
|
| 12 |
|
|
|
| 13 |
schorsch |
1.1 |
class GenbeadsTestCase(unittest.TestCase):
|
| 14 |
|
|
def setUp(self):
|
| 15 |
schorsch |
1.2 |
if _bindir:
|
| 16 |
|
|
self.oldpath = os.environ['PATH']
|
| 17 |
|
|
os.environ['PATH'] = _bindir
|
| 18 |
schorsch |
1.1 |
|
| 19 |
|
|
def tearDown(self):
|
| 20 |
schorsch |
1.2 |
if _bindir:
|
| 21 |
|
|
os.environ['PATH'] = self.oldpath
|
| 22 |
schorsch |
1.1 |
|
| 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 |
schorsch |
1.2 |
def main(bindir=None):
|
| 44 |
|
|
global _bindir
|
| 45 |
|
|
_bindir=bindir
|
| 46 |
schorsch |
1.1 |
support.run_case(GenbeadsTestCase)
|
| 47 |
|
|
|
| 48 |
|
|
if __name__ == '__main__':
|
| 49 |
|
|
main()
|
| 50 |
|
|
|
| 51 |
|
|
# vi: set ts=4 sw=4 :
|