From: Brian Warner Date: Sun, 1 Apr 2007 03:38:43 +0000 (-0700) Subject: remove util.ring, no longer used. also remove test_ring.py X-Git-Url: https://git.rkrishnan.org/?a=commitdiff_plain;h=8bc248a5152b9503edaeb79433a212566f2a19f7;p=tahoe-lafs%2Ftahoe-lafs.git remove util.ring, no longer used. also remove test_ring.py --- diff --git a/src/allmydata/test/test_ring.py b/src/allmydata/test/test_ring.py deleted file mode 100644 index 59737f2b..00000000 --- a/src/allmydata/test/test_ring.py +++ /dev/null @@ -1,19 +0,0 @@ -#! /usr/bin/python - -from twisted.trial import unittest - -from allmydata.util import ring - -class Ring(unittest.TestCase): - def test_1(self): - self.failUnlessEquals(ring.distance(8, 9), 1) - self.failUnlessEquals(ring.distance(9, 8), 2**160-1) - self.failUnlessEquals(ring.distance(2, 2**160-1), 2**160-3) - self.failUnlessEquals(ring.distance(2**160-1, 2), 3) - self.failUnlessEquals(ring.distance(0, 2**159), 2**159) - self.failUnlessEquals(ring.distance(2**159, 0), 2**159) - self.failUnlessEquals(ring.distance(2**159-1, 2**159+1), 2) - self.failUnlessEquals(ring.distance(2**159-1, 1), 2**159+2) - self.failUnlessEquals(ring.distance(2**159-1, 2**159-1), 0) - self.failUnlessEquals(ring.distance(0, 0), 0) - diff --git a/src/allmydata/util/ring.py b/src/allmydata/util/ring.py deleted file mode 100644 index 0ffebecd..00000000 --- a/src/allmydata/util/ring.py +++ /dev/null @@ -1,13 +0,0 @@ - -def distance(p1, p2, FULL = 2**160, HALF = 2**159): - """ - Distance between two points in the space, expressed as longs. - - @param p1: long of first point - @param p2: long of second point - """ - d = p2 - p1 - if d < 0: - d = FULL + d - return d -