def test_coordSequence_distances(self): coord = d03_spiralmemory.coordSequence() print(coord) for i in range(10000): x, y = next(coord) dist = d03_spiralmemory.spiralDistance(i + 1) self.assertEqual( abs(x) + abs(y), dist, "({}, {}), dist: {}".format(x, y, dist))
def test_spiralDistance_368078(self): self.assertEqual(371, d03_spiralmemory.spiralDistance(368078))
def test_spiralDistance_1024(self): self.assertEqual(31, d03_spiralmemory.spiralDistance(1024))
def test_spiralDistance_23(self): self.assertEqual(2, d03_spiralmemory.spiralDistance(23))
def test_spiralDistance_12(self): self.assertEqual(3, d03_spiralmemory.spiralDistance(12))
def test_spiralDistance_4(self): self.assertEqual(1, d03_spiralmemory.spiralDistance(4))
def test_spiralDistance_1(self): self.assertEqual(0, d03_spiralmemory.spiralDistance(1))