def test_can_emit_massfull_3(self): """ Base case: can emit negative mass when negative mass stored. """ neg_mass_prototype = MockPrototype(-1) emitter = MarbleEmitter(neg_mass_prototype, 0, stored_mass=-1) self.assertTrue(emitter.can_emit())
def test_can_emit_massfull_2(self): """ Base case: can emit after adding sufficient mass. """ emitter = MarbleEmitter(self.__massfull_prototype, 0, stored_mass=0) emitter.eat_mass(self.__mass) self.assertTrue(emitter.can_emit())
def test_delay_5(self): """ Base case: cannot emit at start if initial_time_passed is too low. """ emitter = MarbleEmitter(self.__mock_prototype, 10, initial_time_passed=0) self.assertFalse(emitter.can_emit())
def test_delay_4(self): """ Base case: can emit second time after *more* than enough time passed. """ delay = 10 emitter = MarbleEmitter(self.__mock_prototype, delay) emitter.register_time_passed(delay + 10) self.assertTrue(emitter.can_emit())
def test_delay_1(self): """ Base case: can always emit at start if initial_time_passed high enough. """ emitter = MarbleEmitter(self.__mock_prototype, 10, initial_time_passed=10) self.assertTrue(emitter.can_emit())
def test_can_emit_massfull_4(self): """ Base case: can emit if initial mass is sufficient. """ emitter = MarbleEmitter(self.__massfull_prototype, 0, stored_mass=self.__mass) self.assertTrue(emitter.can_emit())
def test_delay_2(self): """ Base case: cannot emit right after previous emit, when delay > 0. """ delay = 10 emitter = MarbleEmitter(self.__mock_prototype, delay) emitter.register_time_passed(delay) emitter.emit() self.assertFalse(emitter.can_emit())
def test_can_emit_massfull_1(self): """ Base case: cannot emit massfull Marble when no mass stored. """ emitter = MarbleEmitter(self.__massfull_prototype, 0, stored_mass=0) self.assertFalse(emitter.can_emit())
def test_can_emit_massfull_5(self): """ Corner case: cannot emit negative mass if own mass is positive. """ emitter = MarbleEmitter(MockPrototype(-1), 0, stored_mass=1) self.assertFalse(emitter.can_emit())