예제 #1
0
def test_bset(num_entries):
    # start_size = h.heap().size

    start = time.time()
    bset = BloomSet(xrange(num_entries))
    created_time = time.time()

    # created_size = h.heap().size

    start_positives_time = time.time()
    for i in xrange(num_entries):
        assert bset.contains(i)
    checked_positives_time = time.time()

    for i in xrange(num_entries, num_entries * 2):
        bset.contains(i)
    checked_negatives_time = time.time()

    t_create = created_time - start
    t_pos = checked_positives_time - start_positives_time
    t_neg = checked_negatives_time - checked_positives_time
    # k_size = int((created_size - start_size) / 1000.0)

    print '''
    num_entries: {0}
    create time: {1}s
    check positives time: {2}s
    check negatives time: {3}s
    '''.format(num_entries, t_create, t_pos, t_neg)
예제 #2
0
class TestAddingElement(TestCase):
    def setUp(self):
        self.bset = BloomSet([])

    def test_adding_element(self):
        self.bset.add_element(120)
        self.assertTrue(self.bset.set1, self.bset.set2)
예제 #3
0
def test_bset(num_entries):
    # start_size = h.heap().size

    start = time.time()
    bset = BloomSet(xrange(num_entries))
    created_time = time.time()

    # created_size = h.heap().size

    start_positives_time = time.time()
    for i in xrange(num_entries):
        assert bset.contains(i)
    checked_positives_time = time.time()

    for i in xrange(num_entries, num_entries * 2):
        bset.contains(i)
    checked_negatives_time = time.time()

    t_create = created_time - start
    t_pos = checked_positives_time - start_positives_time
    t_neg = checked_negatives_time - checked_positives_time
    # k_size = int((created_size - start_size) / 1000.0)

    print '''
    num_entries: {0}
    create time: {1}s
    check positives time: {2}s
    check negatives time: {3}s
    '''.format(num_entries, t_create, t_pos, t_neg)
예제 #4
0
class TestAddingElement(TestCase):

    def setUp(self):
        self.bset = BloomSet([])

    def test_adding_element(self):
        self.bset.add_element(120)
        self.assertTrue(self.bset.set1, self.bset.set2)
예제 #5
0
class TestEmptyBloomSet(TestCase):
    def setUp(self):
        self.bset = BloomSet([])

    def test_empty_bloom_set(self):
        for element in xrange(100):
            self.assertFalse(self.bset.contains(element))
예제 #6
0
class TestEmptyBloomSet(TestCase):

    def setUp(self):
        self.bset = BloomSet([])

    def test_empty_bloom_set(self):
        for element in xrange(100):
            self.assertFalse(self.bset.contains(element))
예제 #7
0
class TestMembership(TestCase):
    def setUp(self):
        self.elements = range(100)
        self.bset = BloomSet(self.elements)

    def test_members(self):
        for element in self.elements:
            self.assertTrue(self.bset.contains(element))
예제 #8
0
class TestMembership(TestCase):

    def setUp(self):
        self.elements = range(100)
        self.bset = BloomSet(self.elements)

    def test_members(self):
        for element in self.elements:
            self.assertTrue(self.bset.contains(element))
예제 #9
0
 def setUp(self):
     self.bset = BloomSet([])
예제 #10
0
 def setUp(self):
     self.elements = range(100)
     self.bset = BloomSet(self.elements)
예제 #11
0
 def setUp(self):
     self.bset = BloomSet(xrange(20))
예제 #12
0
 def setUp(self):
     self.bset = BloomSet([])
예제 #13
0
 def setUp(self):
     self.elements = range(100)
     self.bset = BloomSet(self.elements)