Esempio n. 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)
Esempio n. 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)
Esempio n. 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)
Esempio n. 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)
Esempio n. 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))
Esempio n. 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))
Esempio n. 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))
Esempio n. 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))
Esempio n. 9
0
 def setUp(self):
     self.bset = BloomSet([])
Esempio n. 10
0
 def setUp(self):
     self.elements = range(100)
     self.bset = BloomSet(self.elements)
Esempio n. 11
0
 def setUp(self):
     self.bset = BloomSet(xrange(20))
Esempio n. 12
0
 def setUp(self):
     self.bset = BloomSet([])
Esempio n. 13
0
 def setUp(self):
     self.elements = range(100)
     self.bset = BloomSet(self.elements)