def test_drop_keep_estimated_cost_fate_dice(self): self._test_dice_drop = DropKeepExpression("4dFd2", self._probability_distribution_factory) self._test_dice_keep = DropKeepExpression("4dFk2", self._probability_distribution_factory) self.assertEqual(24, self._test_dice_drop.estimated_cost()) self.assertEqual(24, self._test_dice_keep.estimated_cost())
def test_drop_keep_estimated_custom_dice_negative(self): self._test_dice_drop = DropKeepExpression("4d[-2,2,100]d2", self._probability_distribution_factory) self._test_dice_keep = DropKeepExpression("4d[-2,2,100]k2", self._probability_distribution_factory) self.assertEqual(24, self._test_dice_drop.estimated_cost()) self.assertEqual(24, self._test_dice_keep.estimated_cost())
def test_drop_keep_estimated_cost_missing_dice_amount(self): self._test_dice_drop = DropKeepExpression("d6d2", self._probability_distribution_factory) self._test_dice_keep = DropKeepExpression("d6k2", self._probability_distribution_factory) self.assertEqual(2, self._test_dice_drop.estimated_cost()) self.assertEqual(6, self._test_dice_keep.estimated_cost())
def test_drop_keep_estimated_cost_percentile_dice(self): self._test_dice_drop = DropKeepExpression("4d%d2", self._probability_distribution_factory) self._test_dice_keep = DropKeepExpression("4d%k2", self._probability_distribution_factory) self.assertEqual(800, self._test_dice_drop.estimated_cost()) self.assertEqual(800, self._test_dice_keep.estimated_cost())
def test_drop_keep_str_keep_fate_dice(self): test_dice = DropKeepExpression("3dFk2", self._probability_distribution_factory) self.assertEqual("3dFk2", str(test_dice))
def test_drop_keep_str_drop_custom_dice(self): test_dice = DropKeepExpression("3d[-3,2,4]d1", self._probability_distribution_factory) self.assertEqual("3d[-3,2,4]d1", str(test_dice))
def test_drop_keep_min_drop_to_zero(self): test_dice = DropKeepExpression("2d3d0", self._probability_distribution_factory) self.assertEqual(2, test_dice.min())
def test_drop_keep_str_drop_percentile_dice(self): test_dice = DropKeepExpression("24d%d12", self._probability_distribution_factory) self.assertEqual("24d%d12", str(test_dice))
def test_drop_keep_min_keep_custom_dice(self): test_dice = DropKeepExpression("3d[5,10,15]k2", self._probability_distribution_factory) self.assertEqual(10, test_dice.min())
def test_drop_keep_min_drop_fate_dice(self): test_dice = DropKeepExpression("3dFd1", self._probability_distribution_factory) self.assertEqual(-2, test_dice.min())
def test_drop_keep_add_production_function(self): DropKeepExpression.add_production_function(self._mock_parser_gen, self._probability_distribution_factory) self._mock_parser_gen.production.assert_called_once_with("""expression : DROP_KEEP_DICE""")
def test_drop_keep_min_keep_percentile_dice(self): test_dice = DropKeepExpression("14d%k12", self._probability_distribution_factory) self.assertEqual(12, test_dice.min())
def test_drop_keep_max_drop_to_many(self): test_dice = DropKeepExpression("2d3d10", self._probability_distribution_factory) self.assertEqual(0, test_dice.max())