def finalize(self, (share_count, share_hashes)):
return share_hashes
-
-if __name__ == '__main__':
- import random
- from p2pool.util import forest
- t = forest.Tracker()
- d = WeightsSkipList(t)
- for i in xrange(2000):
- t.add(data.FakeShare(hash=i, previous_hash=i - 1 if i > 0 else None, new_script=i, target=random.randrange(2**249, 2**250)))
- for i in xrange(2000):
- #a = random.randrange(2000)
- a = 1999
- print d(a, a, 1000000)[1]
--- /dev/null
+import random
+import unittest
+
+from p2pool import skiplists
+from p2pool.util import forest
+from p2pool.test.util import test_forest
+
+class Test(unittest.TestCase):
+ def test_all(self):
+ t = forest.Tracker()
+ d = skiplists.WeightsSkipList(t)
+ for i in xrange(200):
+ t.add(test_forest.FakeShare(hash=i, previous_hash=i - 1 if i > 0 else None, new_script=i, donation=1234, target=2**249))
+ for i in xrange(200):
+ a = random.randrange(200)
+ d(a, random.randrange(a + 1), 1000000*65535)[1]