def test_exist(self): self.assertFalse(DC.exist('test-counter')) DC.increment('test-counter') DC.minify('test-counter') self.assertTrue(DC.exist('test-counter')) DC.delete('test-counter') self.assertFalse(DC.exist('test-counter'))
def test_set(self): val = DC.get_value('set-count') DC.increment('set-count', 5) DC.set('set-count', val + 10) val += 10 self.assertEquals(DC.get_value('set-count'), val)
def test_increment(self): val = DC.get_value('incr-count') # Single Increment Steps for dummy in range(INCREMENT_STEPS): DC.increment('incr-count') val += INCREMENT_STEPS DC.minify('incr-count') self.assertEquals(DC.get_value('incr-count'), val) # Multiple Increment Steps for dummy in range(INCREMENT_STEPS): DC.increment('incr-count', INCREMENT_VALUE) val += INCREMENT_STEPS * INCREMENT_VALUE DC.minify('incr-count') self.assertEquals(DC.get_value('incr-count'), val) # Random Increment Steps for dummy in range(INCREMENT_STEPS): delta = random.randint(1, RAND_INCREMENT_MAX) val += delta DC.increment('incr-count', delta) DC.minify('incr-count') self.assertEquals(DC.get_value('incr-count'), val) DC.decrement('incr-count', val + 10) DC.minify('incr-count') self.assertEquals(DC.get_value('incr-count'), -10)