def test_xform_e_mx(self): cmd = 'xform -e -mx "%s"' % support.datafile('xform_2.dat') result = lcompare.split_rad(os.popen(cmd).read()) expect = lcompare.split_radfile(support.datafile('xform_res2.dat')) try: lcompare.llcompare(result, expect, ignore_empty=1) except lcompare.error, e: self.fail('%s [%s]' % (str(e),cmd))
def test_2(self): cmd = 'cnt 3 2' res0 = os.popen(cmd).read() res = map(string.split,string.split(res0, '\n')) exp = [[0,0], [0,1], [1,0], [1,1], [2,0], [2,1], []] try: lcompare.llcompare(res, exp) except lcompare.error, e: self.fail(str(e))
def test_xform(self): cmd = 'xform -e -mx "%s"' % support.datafile('xform_2.dat') result = lcompare.split_rad(os.popen(cmd).read()) expect = lcompare.split_radfile(support.datafile('xform_res2.dat')) try: lcompare.llcompare(result, expect, ignore_empty=1) except lcompare.error, e: self.fail('%s [%s]' % (str(e),cmd))
def test_2(self): cmd = 'cnt 3 2' res0 = os.popen(cmd).read() res = map(string.split, string.split(res0, '\n')) exp = [[0, 0], [0, 1], [1, 0], [1, 1], [2, 0], [2, 1], []] try: lcompare.llcompare(res, exp) except lcompare.error, e: self.fail(str(e))
def test_getinfo_d(self): picfile = support.datafile('Earth128.pic') cmd = 'getinfo -d "%s"' % picfile res0 = os.popen(cmd).read() result = map(string.split,string.split(res0, '\n')) exps = '''%s: -Y 128 +X 128''' % picfile expect = map(string.split, string.split(exps, '\n')) try: lcompare.llcompare(result, expect, ignore_empty=1) except lcompare.error, e: self.fail('%s [%s]' % (str(e),cmd))
def test_lam(self): dat_de = support.datafile('lam_de.dat') dat_en = support.datafile('lam_en.dat') cmd = 'rlam -t: "%s" "%s"' % (dat_de, dat_en) raw = os.popen(cmd).read() result = map(string.split,string.split(raw,'\n')) expect = [ ['eins:one'], ['zwei:two'], ['drei:three'], ['vier:four'], ['fuenf:five'], ] try: lcompare.llcompare(result, expect, ignore_empty=1) except lcompare.error, e: self.fail('%s [%s]' % (str(e),cmd))
def test_genbeads(self): cmd = 'genbeads mymat myname 0 0 0 1 1 1 2 0 0 0 2 0 .1 .4' raw = os.popen(cmd).read() result = map(string.split,string.split(raw,'\n')) expect = [['mymat', 'sphere', 'myname.0'], [0], [0], [4, 0, 0, 0, 0.1], ['mymat', 'sphere', 'myname.1'], [0], [0], [4, 0.36, 0.04, 0.104, 0.1], ['mymat', 'sphere', 'myname.2'], [0], [0], [4, 0.651440715413, 0.167781092737, 0.365893348046, 0.1], ['mymat', 'sphere', 'myname.3'], [0], [0], [4, 0.844350245496, 0.366600314978, 0.655866088042, 0.1], ['mymat', 'sphere', 'myname.4'], [0], [0], [4, 0.960791445178, 0.643185551339, 0.897901825177, 0.1], ] try: lcompare.llcompare(result, expect, ignore_empty=1) except lcompare.error, e: self.fail('%s [%s]' % (str(e),cmd))
def test_histo_p(self): cmd = 'histo -p -0.5 8.5 9 < "%s"' % support.datafile('histo.dat') raw = os.popen(cmd).read() result = map(string.split,string.split(raw,'\n')) expect = [ [0, 33.333333, 11.111111, 20.0, 50.0, 12.5], [1, 33.333333, 11.111111, 20.0, 50.0, 12.5], [2, 33.333333, 11.111111, 20.0, 0.0, 12.5], [3, 0.0, 11.111111, 20.0, 0.0, 12.5], [4, 0.0, 11.111111, 20.0, 0.0, 12.5], [5, 0.0, 11.111111, 0.0, 0.0, 12.5], [6, 0.0, 11.111111, 0.0, 0.0, 12.5], [7, 0.0, 11.111111, 0.0, 0.0, 12.5], [8, 0.0, 11.111111, 0.0, 0.0, 0.0], ] try: lcompare.llcompare(result, expect, ignore_empty=1) except lcompare.error, e: self.fail('%s [%s]' % (str(e),cmd))
def test_histo(self): cmd = 'histo -0.5 8.5 9 < "%s"' % support.datafile('histo.dat') raw = os.popen(cmd).read() result = map(string.split,string.split(raw,'\n')) expect = [ [0, 720, 240, 432, 1080, 270], [1, 720, 240, 432, 1080, 270], [2, 720, 240, 432, 0, 270], [3, 0, 240, 432, 0, 270], [4, 0, 240, 432, 0, 270], [5, 0, 240, 0, 0, 270], [6, 0, 240, 0, 0, 270], [7, 0, 240, 0, 0, 270], [8, 0, 240, 0, 0, 0], ] try: lcompare.llcompare(result, expect, ignore_empty=1) except lcompare.error, e: self.fail('%s [%s]' % (str(e),cmd))
def test_histo_p(self): cmd = 'histo -p -0.5 8.5 9 < "%s"' % support.datafile('histo.dat') raw = os.popen(cmd).read() result = map(string.split, string.split(raw, '\n')) expect = [ [0, 33.333333, 11.111111, 20.0, 50.0, 12.5], [1, 33.333333, 11.111111, 20.0, 50.0, 12.5], [2, 33.333333, 11.111111, 20.0, 0.0, 12.5], [3, 0.0, 11.111111, 20.0, 0.0, 12.5], [4, 0.0, 11.111111, 20.0, 0.0, 12.5], [5, 0.0, 11.111111, 0.0, 0.0, 12.5], [6, 0.0, 11.111111, 0.0, 0.0, 12.5], [7, 0.0, 11.111111, 0.0, 0.0, 12.5], [8, 0.0, 11.111111, 0.0, 0.0, 0.0], ] try: lcompare.llcompare(result, expect, ignore_empty=1) except lcompare.error, e: self.fail('%s [%s]' % (str(e), cmd))
def test_histo(self): cmd = 'histo -0.5 8.5 9 < "%s"' % support.datafile('histo.dat') raw = os.popen(cmd).read() result = map(string.split, string.split(raw, '\n')) expect = [ [0, 720, 240, 432, 1080, 270], [1, 720, 240, 432, 1080, 270], [2, 720, 240, 432, 0, 270], [3, 0, 240, 432, 0, 270], [4, 0, 240, 432, 0, 270], [5, 0, 240, 0, 0, 270], [6, 0, 240, 0, 0, 270], [7, 0, 240, 0, 0, 270], [8, 0, 240, 0, 0, 0], ] try: lcompare.llcompare(result, expect, ignore_empty=1) except lcompare.error, e: self.fail('%s [%s]' % (str(e), cmd))
def test_histo_pc(self): cmd = 'histo -p -c -0.5 8.5 9 < "%s"' % support.datafile('histo.dat') raw = os.popen(cmd).read() result = map(string.split,string.split(raw,'\n')) expect = [ [-0.5, 0.0, 0.0, 0.0, 0.0, 0.0], [0.5, 33.333333, 11.111111, 20.0, 50.0, 12.5], [1.5, 66.666667, 22.222222, 40.0, 100.0, 25.0], [2.5, 100.0, 33.333333, 60.0, 100.0, 37.5], [3.5, 100.0, 44.444444, 80.0, 100.0, 50.0], [4.5, 100.0, 55.555556, 100.0, 100.0, 62.5], [5.5, 100.0, 66.666667, 100.0, 100.0, 75.0], [6.5, 100.0, 77.777778, 100.0, 100.0, 87.5], [7.5, 100.0, 88.888889, 100.0, 100.0, 100.0], [8.5, 100.0, 100.0, 100.0, 100.0, 100.0], ] try: lcompare.llcompare(result, expect, ignore_empty=1) except lcompare.error, e: self.fail('%s [%s]' % (str(e),cmd))
def test_histo_c(self): cmd = 'histo -c -0.5 8.5 9 < "%s"' % support.datafile('histo.dat') raw = os.popen(cmd).read() result = map(string.split,string.split(raw,'\n')) expect = [ [-0.5, 0, 0, 0, 0, 0], [0.5, 720, 240, 432, 1080, 270], [1.5, 1440, 480, 864, 2160, 540], [2.5, 2160, 720, 1296, 2160, 810], [3.5, 2160, 960, 1728, 2160, 1080], [4.5, 2160, 1200, 2160, 2160, 1350], [5.5, 2160, 1440, 2160, 2160, 1620], [6.5, 2160, 1680, 2160, 2160, 1890], [7.5, 2160, 1920, 2160, 2160, 2160], [8.5, 2160, 2160, 2160, 2160, 2160], ] try: lcompare.llcompare(result, expect, ignore_empty=1) except lcompare.error, e: self.fail('%s [%s]' % (str(e),cmd))
def test_histo_pc(self): cmd = 'histo -p -c -0.5 8.5 9 < "%s"' % support.datafile('histo.dat') raw = os.popen(cmd).read() result = map(string.split, string.split(raw, '\n')) expect = [ [-0.5, 0.0, 0.0, 0.0, 0.0, 0.0], [0.5, 33.333333, 11.111111, 20.0, 50.0, 12.5], [1.5, 66.666667, 22.222222, 40.0, 100.0, 25.0], [2.5, 100.0, 33.333333, 60.0, 100.0, 37.5], [3.5, 100.0, 44.444444, 80.0, 100.0, 50.0], [4.5, 100.0, 55.555556, 100.0, 100.0, 62.5], [5.5, 100.0, 66.666667, 100.0, 100.0, 75.0], [6.5, 100.0, 77.777778, 100.0, 100.0, 87.5], [7.5, 100.0, 88.888889, 100.0, 100.0, 100.0], [8.5, 100.0, 100.0, 100.0, 100.0, 100.0], ] try: lcompare.llcompare(result, expect, ignore_empty=1) except lcompare.error, e: self.fail('%s [%s]' % (str(e), cmd))
def test_histo_c(self): cmd = 'histo -c -0.5 8.5 9 < "%s"' % support.datafile('histo.dat') raw = os.popen(cmd).read() result = map(string.split, string.split(raw, '\n')) expect = [ [-0.5, 0, 0, 0, 0, 0], [0.5, 720, 240, 432, 1080, 270], [1.5, 1440, 480, 864, 2160, 540], [2.5, 2160, 720, 1296, 2160, 810], [3.5, 2160, 960, 1728, 2160, 1080], [4.5, 2160, 1200, 2160, 2160, 1350], [5.5, 2160, 1440, 2160, 2160, 1620], [6.5, 2160, 1680, 2160, 2160, 1890], [7.5, 2160, 1920, 2160, 2160, 2160], [8.5, 2160, 2160, 2160, 2160, 2160], ] try: lcompare.llcompare(result, expect, ignore_empty=1) except lcompare.error, e: self.fail('%s [%s]' % (str(e), cmd))
def test_getinfo(self): picfile = support.datafile('Earth128.pic') cmd = 'getinfo "%s"' % picfile res0 = os.popen(cmd).read() result = lcompare.split_headers(res0) exps = '''%s: Xim format conversion by: FORMAT=32-bit_rle_rgbe pfilt -e 2 -x 512 -y 512 -p 1 -r .67 EXPOSURE=4.926198e+00 normpat pfilt -1 -e .2 EXPOSURE=2.000000e-01 pfilt -x 128 -y 128 PIXASPECT=0.500000 EXPOSURE=2.571646e+00''' % picfile expect = lcompare.split_headers(exps) try: lcompare.llcompare(result, expect, ignore_empty=1) except lcompare.error, e: self.fail('%s [%s]' % (str(e),cmd))