1 |
|
|
2 |
|
import os |
3 |
– |
import math |
3 |
|
import string |
4 |
|
import unittest |
5 |
|
|
15 |
|
os.environ['PATH'] = self.oldpath |
16 |
|
|
17 |
|
def test_histo(self): |
18 |
< |
cmd = 'histo 1 6 5 < "%s"' % support.datafile('histo.dat') |
18 |
> |
cmd = 'histo -0.5 8.5 9 < "%s"' % support.datafile('histo.dat') |
19 |
|
raw = os.popen(cmd).read() |
20 |
|
result = map(string.split,string.split(raw,'\n')) |
21 |
|
expect = [ |
22 |
< |
[1.5, 720, 240, 432, 1080, 270], |
23 |
< |
[2.5, 720, 240, 432, 0, 270], |
24 |
< |
[3.5, 0, 240, 432, 0, 270], |
25 |
< |
[4.5, 0, 240, 432, 0, 270], |
26 |
< |
[5.5, 0, 240, 0, 0, 270], |
22 |
> |
[0, 720, 240, 432, 1080, 270], |
23 |
> |
[1, 720, 240, 432, 1080, 270], |
24 |
> |
[2, 720, 240, 432, 0, 270], |
25 |
> |
[3, 0, 240, 432, 0, 270], |
26 |
> |
[4, 0, 240, 432, 0, 270], |
27 |
> |
[5, 0, 240, 0, 0, 270], |
28 |
> |
[6, 0, 240, 0, 0, 270], |
29 |
> |
[7, 0, 240, 0, 0, 270], |
30 |
> |
[8, 0, 240, 0, 0, 0], |
31 |
> |
] |
32 |
> |
try: lcompare.llcompare(result, expect, ignore_empty=1) |
33 |
> |
except lcompare.error, e: |
34 |
> |
self.fail('%s [%s]' % (str(e),cmd)) |
35 |
> |
|
36 |
> |
def test_histo_c(self): |
37 |
> |
cmd = 'histo -c -0.5 8.5 9 < "%s"' % support.datafile('histo.dat') |
38 |
> |
raw = os.popen(cmd).read() |
39 |
> |
result = map(string.split,string.split(raw,'\n')) |
40 |
> |
expect = [ |
41 |
> |
[-0.5, 0, 0, 0, 0, 0], |
42 |
> |
[0.5, 720, 240, 432, 1080, 270], |
43 |
> |
[1.5, 1440, 480, 864, 2160, 540], |
44 |
> |
[2.5, 2160, 720, 1296, 2160, 810], |
45 |
> |
[3.5, 2160, 960, 1728, 2160, 1080], |
46 |
> |
[4.5, 2160, 1200, 2160, 2160, 1350], |
47 |
> |
[5.5, 2160, 1440, 2160, 2160, 1620], |
48 |
> |
[6.5, 2160, 1680, 2160, 2160, 1890], |
49 |
> |
[7.5, 2160, 1920, 2160, 2160, 2160], |
50 |
> |
[8.5, 2160, 2160, 2160, 2160, 2160], |
51 |
> |
] |
52 |
> |
try: lcompare.llcompare(result, expect, ignore_empty=1) |
53 |
> |
except lcompare.error, e: |
54 |
> |
self.fail('%s [%s]' % (str(e),cmd)) |
55 |
> |
|
56 |
> |
def test_histo_p(self): |
57 |
> |
cmd = 'histo -p -0.5 8.5 9 < "%s"' % support.datafile('histo.dat') |
58 |
> |
raw = os.popen(cmd).read() |
59 |
> |
result = map(string.split,string.split(raw,'\n')) |
60 |
> |
expect = [ |
61 |
> |
[0, 33.333333, 11.111111, 20.0, 50.0, 12.5], |
62 |
> |
[1, 33.333333, 11.111111, 20.0, 50.0, 12.5], |
63 |
> |
[2, 33.333333, 11.111111, 20.0, 0.0, 12.5], |
64 |
> |
[3, 0.0, 11.111111, 20.0, 0.0, 12.5], |
65 |
> |
[4, 0.0, 11.111111, 20.0, 0.0, 12.5], |
66 |
> |
[5, 0.0, 11.111111, 0.0, 0.0, 12.5], |
67 |
> |
[6, 0.0, 11.111111, 0.0, 0.0, 12.5], |
68 |
> |
[7, 0.0, 11.111111, 0.0, 0.0, 12.5], |
69 |
> |
[8, 0.0, 11.111111, 0.0, 0.0, 0.0], |
70 |
> |
] |
71 |
> |
try: lcompare.llcompare(result, expect, ignore_empty=1) |
72 |
> |
except lcompare.error, e: |
73 |
> |
self.fail('%s [%s]' % (str(e),cmd)) |
74 |
> |
|
75 |
> |
def test_histo_pc(self): |
76 |
> |
cmd = 'histo -p -c -0.5 8.5 9 < "%s"' % support.datafile('histo.dat') |
77 |
> |
raw = os.popen(cmd).read() |
78 |
> |
result = map(string.split,string.split(raw,'\n')) |
79 |
> |
expect = [ |
80 |
> |
[-0.5, 0.0, 0.0, 0.0, 0.0, 0.0], |
81 |
> |
[0.5, 33.333333, 11.111111, 20.0, 50.0, 12.5], |
82 |
> |
[1.5, 66.666667, 22.222222, 40.0, 100.0, 25.0], |
83 |
> |
[2.5, 100.0, 33.333333, 60.0, 100.0, 37.5], |
84 |
> |
[3.5, 100.0, 44.444444, 80.0, 100.0, 50.0], |
85 |
> |
[4.5, 100.0, 55.555556, 100.0, 100.0, 62.5], |
86 |
> |
[5.5, 100.0, 66.666667, 100.0, 100.0, 75.0], |
87 |
> |
[6.5, 100.0, 77.777778, 100.0, 100.0, 87.5], |
88 |
> |
[7.5, 100.0, 88.888889, 100.0, 100.0, 100.0], |
89 |
> |
[8.5, 100.0, 100.0, 100.0, 100.0, 100.0], |
90 |
|
] |
91 |
|
try: lcompare.llcompare(result, expect, ignore_empty=1) |
92 |
|
except lcompare.error, e: |