def test_chunk_size(self): # print('----------- test_chunk_size:') for s in range(270, 64 * 270, 270): ts = utils.compute_tile_size(s, chunk_size=256) n = utils.cardinal_div_round(s, ts) utils.cardinal_log2(n * ts)
def test_num_levels_min(self): # print('----------- test_num_levels_min:') for s in range(270, 64 * 270, 270): ts = utils.compute_tile_size(s, num_levels_min=2) n = utils.cardinal_div_round(s, ts) utils.cardinal_log2(n * ts)
def test_num_10(self): self.assertEqual(10, utils.cardinal_div_round(10, 1)) self.assertEqual(5, utils.cardinal_div_round(10, 2)) self.assertEqual(4, utils.cardinal_div_round(10, 3)) self.assertEqual(3, utils.cardinal_div_round(10, 4)) self.assertEqual(2, utils.cardinal_div_round(10, 5)) self.assertEqual(2, utils.cardinal_div_round(10, 6)) self.assertEqual(2, utils.cardinal_div_round(10, 7)) self.assertEqual(2, utils.cardinal_div_round(10, 8)) self.assertEqual(2, utils.cardinal_div_round(10, 9)) self.assertEqual(1, utils.cardinal_div_round(10, 10)) self.assertEqual(1, utils.cardinal_div_round(10, 11)) self.assertEqual(1, utils.cardinal_div_round(10, 11)) self.assertEqual(1, utils.cardinal_div_round(10, 110))
def test_int_div(self): # print('----------- test_int_div:') for s in range(270, 64 * 270, 270): ts = utils.compute_tile_size(s, int_div=True) n = utils.cardinal_div_round(s, ts) utils.cardinal_log2(n * ts)
def test_num_0(self): self.assertEqual(2, utils.cardinal_div_round(0, -1)) self.assertRaises(ZeroDivisionError, utils.cardinal_div_round, 0, 0) self.assertEqual(0, utils.cardinal_div_round(0, 1)) self.assertEqual(0, utils.cardinal_div_round(0, 110))