Example #1
0
    def test_add_zero_valueerror(self):
        """
        Test that adding 0 number of dice raises a ValueError.
        """

        roll = Roll(3)
        roll.add(0)
Example #2
0
    def test_add_negative_valueerror(self):
        """
        Test that adding a negative number of dice raises a ValueError.
        """

        roll = Roll(3)
        roll.add(-3)
Example #3
0
    def test_add_not_int_valueerror(self):
        """
        Test that adding a non-integer number of dice raises a ValueError.
        """

        roll = Roll(3)
        roll.add([2, 4, 3])
Example #4
0
    def test_add_becomes_glitch(self):
        """
        Test that adding dice with glitches causes the roll to become a glitch.
        """

        roll = Roll(3)
        self.assertFalse(roll.glitch)
        roll.add(2)
        self.assertTrue(roll.glitch)
Example #5
0
    def test_add_gliches_added(self):
        """
        Test that adding dice updates the number of glitches.
        """

        roll = Roll(3)
        self.assertEquals(roll.glitches, 2)
        roll.add(3)
        self.assertEquals(roll.glitches, 3)
Example #6
0
    def test_add_original_dice_pool_not_increased(self):
        """
        Test that adding dice does not affect the original number of dice.
        """

        roll = Roll(4)
        self.assertEquals(roll.original_dice_pool, 4)
        roll.add(3)
        self.assertEquals(roll.original_dice_pool, 4)
Example #7
0
    def test_add_dice_pool_increased(self):
        """
        Test that adding dice updates the number of dice.
        """

        roll = Roll(4)
        self.assertEquals(roll.dice_pool, 4)
        roll.add(3)
        self.assertEquals(roll.dice_pool, 7)
Example #8
0
    def test_add_hits_increased(self):
        """
        Test that adding dice updates the number of hits.
        """

        roll = Roll(3)
        self.assertEquals(roll.hits, 1)
        roll.add(3)
        self.assertEquals(roll.hits, 2)
Example #9
0
    def test_add_dice_updated(self):
        """
        Test that adding dice updates the dice list.
        """

        roll = Roll(3)
        self.assertEquals(roll.dice, [1, 3, 5])
        roll.add(3)
        self.assertEquals(roll.dice, [1, 3, 5, 2, 4, 1])
Example #10
0
    def test_add_becomes_fumble(self):
        """
        Test that adding dice with glitches causes the roll to become a fumble.
        """

        roll = Roll(3)
        self.assertFalse(roll.fumble)
        roll.add(2)
        self.assertTrue(roll.fumble)
Example #11
0
    def test_reroll_causes_fumble(self):
        """
        Test that reloading resulting in glitches can cause a fumble.
        """

        roll = Roll(3)
        self.assertFalse(roll.fumble)
        roll.reroll()
        self.assertTrue(roll.fumble)
Example #12
0
    def test_reroll_causes_glitch(self):
        """
        Test that reloading resulting in glitches can cause a glitch.
        """

        roll = Roll(3)
        self.assertFalse(roll.glitch)
        roll.reroll()
        self.assertTrue(roll.glitch)
Example #13
0
    def test_reroll_glitches_updated(self):
        """
        Test that rerolling updates the number of glitches.
        """

        roll = Roll(4)
        self.assertEquals(roll.glitches, 2)
        roll.reroll()
        self.assertEquals(roll.glitches, 3)
Example #14
0
    def test_reroll_hits_updated(self):
        """
        Test that rerolling updates the number of hits.
        """

        roll = Roll(4)
        self.assertEquals(roll.hits, 2)
        roll.reroll()
        self.assertEquals(roll.hits, 4)
Example #15
0
    def test_reroll_hits_unaffected(self):
        """
        Test that rerolling does not affect hits.
        """

        roll = Roll(4)
        self.assertEquals(roll.dice, [6, 5, 3, 2])
        roll.reroll()
        self.assertEquals(roll.dice, [6, 5, 1, 2])
Example #16
0
    def test_add_edge_explodes(self):
        """
        Test that adding sixes explode, as they are added using Edge.
        """

        roll = Roll(3)
        self.assertEquals(roll.dice_pool, 3)
        roll.add(3)
        self.assertEquals(roll.dice_pool, 7)
        self.assertEquals(roll.dice, [6, 2, 3, 6, 1, 4, 1])
Example #17
0
    def test_reroll_exploded_rerolled(self):
        """
        Test that exploded dice that are not hits are also rerolled.
        """

        roll = Roll(3, edge=True)
        self.assertEquals(roll.dice, [1, 2, 6, 1])
        self.assertEquals(roll.original_dice_pool, 3)
        self.assertEquals(roll.dice_pool, 4)
        roll.reroll()
        self.assertEquals(roll.dice, [6, 3, 4, 5])
        self.assertEquals(roll.original_dice_pool, 3)
        self.assertEquals(roll.dice_pool, 4)
Example #18
0
    def test_reroll_dont_explode(self):
        """
        Test that rerolled that are sixes dice do not explode.
        """

        roll = Roll(3)
        self.assertEquals(roll.dice, [1, 2, 6])
        self.assertEquals(roll.original_dice_pool, 3)
        self.assertEquals(roll.dice_pool, 3)
        roll.reroll()
        self.assertEquals(roll.dice, [6, 6, 5])
        self.assertEquals(roll.original_dice_pool, 3)
        self.assertEquals(roll.dice_pool, 3)