Ejemplo n.º 1
0
 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())
Ejemplo n.º 2
0
 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())
Ejemplo n.º 3
0
 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())
Ejemplo n.º 4
0
 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())
Ejemplo n.º 5
0
 def test_drop_keep_str_keep_fate_dice(self):
     test_dice = DropKeepExpression("3dFk2", self._probability_distribution_factory)
     self.assertEqual("3dFk2", str(test_dice))
Ejemplo n.º 6
0
 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))
Ejemplo n.º 7
0
 def test_drop_keep_min_drop_to_zero(self):
     test_dice = DropKeepExpression("2d3d0", self._probability_distribution_factory)
     self.assertEqual(2, test_dice.min())
Ejemplo n.º 8
0
 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))
Ejemplo n.º 9
0
 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())
Ejemplo n.º 10
0
 def test_drop_keep_min_drop_fate_dice(self):
     test_dice = DropKeepExpression("3dFd1", self._probability_distribution_factory)
     self.assertEqual(-2, test_dice.min())
Ejemplo n.º 11
0
 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""")
Ejemplo n.º 12
0
 def test_drop_keep_min_keep_percentile_dice(self):
     test_dice = DropKeepExpression("14d%k12", self._probability_distribution_factory)
     self.assertEqual(12, test_dice.min())
Ejemplo n.º 13
0
 def test_drop_keep_max_drop_to_many(self):
     test_dice = DropKeepExpression("2d3d10", self._probability_distribution_factory)
     self.assertEqual(0, test_dice.max())