From 8bc248a5152b9503edaeb79433a212566f2a19f7 Mon Sep 17 00:00:00 2001 From: Brian Warner Date: Sat, 31 Mar 2007 20:38:43 -0700 Subject: [PATCH] remove util.ring, no longer used. also remove test_ring.py --- src/allmydata/test/test_ring.py | 19 ------------------- src/allmydata/util/ring.py | 13 ------------- 2 files changed, 32 deletions(-) delete mode 100644 src/allmydata/test/test_ring.py delete mode 100644 src/allmydata/util/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 - -- 2.45.2