Пример #1
0
class checkHit(unittest.TestCase):
    """ Test cases of checkHit """
    
    def  setUp(self):
        """ Build the Delegate for the test """
        self.delegate = HitDelegate(None, 100)
        
    def noHit(self):
        """ Test that it does not hit if the toHit is lower than the Rand """
        rand = 100
        toHit = 0
        
        hit = self.delegate.checkHit(rand, toHit)
        assert not hit, "Should not hit"
        
    def hit(self):
        """ Test that it hits if toHit is greater than the Rand """
        rand = 0
        toHit = 100
        
        hit = self.delegate.checkHit(rand, toHit)
        assert hit, "Should hit"