def test_init_with_constructor(self): #create a NDimensional object dims = core.ivector4(10,10,10,10) ndim = data.NDimensional4(dims) for i in ndim.getSizeAsVector(): self.assertTrue( i == 10 )
def test_get_relevant_dims(self): self.assertTrue( self.ndim.getRelevantDims() == 4 ) self.assertTrue( data.NDimensional4(core.ivector4(1,64,1,1)).getRelevantDims() == 2)
def setUp(self): self.ndim = data.NDimensional4(core.ivector4(100,200,100,10))
def test_range_check1(self): self.assertTrue( self.ndim.isInRange(core.ivector4(0,0,0,0) ) ) self.assertTrue( self.ndim.isInRange(core.ivector4(99,199,99,9) ) ) self.assertTrue( not self.ndim.isInRange(core.ivector4(100,199,99,9) ) )
def test_get_linear_index1(self): self.assertTrue( self.ndim.getLinearIndex(core.ivector4(0,0,0,0)) == 0 ) self.assertTrue( self.ndim.getLinearIndex(core.ivector4(99,199,99,9)) == (100 * 200 * 100 * 10 - 1) )
def test_init_with_init1(self): dims = core.ivector4(12,12,12,12) ndim = data.NDimensional4() ndim.init(dims) for i in ndim.getSizeAsVector(): self.assertTrue( i == 12 )