def test_003_lut (self): """tests slicing""" src=gr.vector_source_b((1,3,2,0)) table=[[1,5,3,9],[2,3,8,-1],[3,9,12,3]]; # FIXME: static method called via instance... table_sliced = mlse_swig.lut_biv(table).slice_lut(table, 1, 2) # test if the slice was correct self.assertEquals(table_sliced, tuple([ tuple(l[1:3]) for l in table ]) ) expected_result = [ table[i][1:3] for i in (1,0,2,0) ] expected_result = tuple(itertools.chain.from_iterable(expected_result)) dst=gr.vector_sink_i(len(table_sliced[0])) lut=mlse_swig.lut_biv(table_sliced) self.tb.connect(src,lut,dst) self.tb.run() result_data = dst.data () self.assertEquals(expected_result, result_data)
def test_003_lut(self): """tests slicing""" src = gr.vector_source_b((1, 3, 2, 0)) table = [[1, 5, 3, 9], [2, 3, 8, -1], [3, 9, 12, 3]] # FIXME: static method called via instance... table_sliced = mlse_swig.lut_biv(table).slice_lut(table, 1, 2) # test if the slice was correct self.assertEquals(table_sliced, tuple([tuple(l[1:3]) for l in table])) expected_result = [table[i][1:3] for i in (1, 0, 2, 0)] expected_result = tuple(itertools.chain.from_iterable(expected_result)) dst = gr.vector_sink_i(len(table_sliced[0])) lut = mlse_swig.lut_biv(table_sliced) self.tb.connect(src, lut, dst) self.tb.run() result_data = dst.data() self.assertEquals(expected_result, result_data)
def test_004_lut (self): """tests slicing with reversing""" table=[[1,5,3,9],[2,3,8,-1],[3,9,12,3]]; # FIXME: static method called via instance... table_sliced = mlse_swig.lut_biv(table).slice_lut(table, 0, 2, True) expected_slice = tuple([ tuple(reversed(l[2:4])) for l in table ]) # test if the slice was correct self.assertEquals(table_sliced, expected_slice)
def test_004_lut(self): """tests slicing with reversing""" table = [[1, 5, 3, 9], [2, 3, 8, -1], [3, 9, 12, 3]] # FIXME: static method called via instance... table_sliced = mlse_swig.lut_biv(table).slice_lut(table, 0, 2, True) expected_slice = tuple([tuple(reversed(l[2:4])) for l in table]) # test if the slice was correct self.assertEquals(table_sliced, expected_slice)
def test_001_lut (self): """test with integers""" src=gr.vector_source_b((1,3,2,0)) table=[[1,5,3,9],[2,3,8,-1],[3,9,12,3]]; expected_result = [ table[i] for i in (1,0,2,0) ] expected_result = tuple(itertools.chain.from_iterable(expected_result)) dst=gr.vector_sink_i(len(table[0])) lut=mlse_swig.lut_biv(table) self.tb.connect(src,lut,dst) self.tb.run() result_data = dst.data () self.assertEquals(expected_result, result_data)
def test_001_lut(self): """test with integers""" src = gr.vector_source_b((1, 3, 2, 0)) table = [[1, 5, 3, 9], [2, 3, 8, -1], [3, 9, 12, 3]] expected_result = [table[i] for i in (1, 0, 2, 0)] expected_result = tuple(itertools.chain.from_iterable(expected_result)) dst = gr.vector_sink_i(len(table[0])) lut = mlse_swig.lut_biv(table) self.tb.connect(src, lut, dst) self.tb.run() result_data = dst.data() self.assertEquals(expected_result, result_data)