def testIndicator(self): #TODO print >> sys.stderr, "Testing HyperLogLog.indicate()..." sample_hll = HyperLogLog(4) sample_hll.registers[0] = 6 sample_hll.registers[1] = 12 self.assertEquals(sample_hll.indicate(), 0)
def testPrintHLL(self): """ Make sure we're printing all right """ print >> sys.stderr, "Testing HyperLogLog.__repr__()..." hll = HyperLogLog(16) self.assertEquals(hll.__repr__(), str([0L] * 16))
def testAddressor(self): sample_hll = HyperLogLog(16) self.assertTupleEqual((11, 6), sample_hll.address(2954909337))
def testInitializer(self): print >> sys.stderr, "Testing HyperLogLog.__init__()..." #TODO: ? x = HyperLogLog(16) x.update(5) return
simple_sampler = L0(20, 8) #print simple_sampler print "\nTESTING UPDATE FUNCTION\n" simple_sampler.update(2, 1) simple_sampler.update(3, 3) simple_sampler.update(4, 5) simple_sampler.update(5, 7) simple_sampler.update(6, 20) simple_sampler.update(7, 45) simple_sampler.update(8, 100) simple_sampler.update(9, 200) simple_sampler.update(10, 500) #for _num in range(1,20): # simple_sampler.update(_num, 1) print simple_sampler print "\nTESTING RECOVERY FUNCTION:\n" recovered_weight = simple_sampler.recover() print recovered_weight print simple_sampler.recursive_selection() raw_input('Continue?') """ hll_demo = HyperLogLog(2) print hll_demo