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 |
|
|
class HistoTestCase(unittest.TestCase): |
11 |
|
|
def setUp(self): |
12 |
|
|
self.oldpath = os.environ['PATH'] |
13 |
|
|
os.environ['PATH'] = os.path.abspath(support.BINDIR) |
14 |
|
|
|
15 |
|
|
def tearDown(self): |
16 |
|
|
os.environ['PATH'] = self.oldpath |
17 |
|
|
|
18 |
|
|
def test_histo(self): |
19 |
|
|
cmd = 'histo 1 6 5 < "%s"' % support.datafile('histo.dat') |
20 |
|
|
raw = os.popen(cmd).read() |
21 |
|
|
result = map(string.split,string.split(raw,'\n')) |
22 |
|
|
expect = [ |
23 |
|
|
[1.5, 720, 240, 432, 1080, 270], |
24 |
|
|
[2.5, 720, 240, 432, 0, 270], |
25 |
|
|
[3.5, 0, 240, 432, 0, 270], |
26 |
|
|
[4.5, 0, 240, 432, 0, 270], |
27 |
|
|
[5.5, 0, 240, 0, 0, 270], |
28 |
|
|
] |
29 |
|
|
try: lcompare.llcompare(result, expect, ignore_empty=1) |
30 |
|
|
except lcompare.error, e: |
31 |
|
|
self.fail('%s [%s]' % (str(e),cmd)) |
32 |
|
|
|
33 |
|
|
def main(): |
34 |
|
|
support.run_case(HistoTestCase) |
35 |
|
|
|
36 |
|
|
if __name__ == '__main__': |
37 |
|
|
main() |
38 |
|
|
|
39 |
|
|
# vi: set ts=4 sw=4 : |