Esempio n. 1
0
 def test_cache(self):
     """Test that evaluation returns the same result on successive runs"""
     roll('6d(6d6)t')
     ast = Total(Dice(6, Dice(6, 6)))
     evals = [ast.evaluate_cached() for i in range(100)]
     assert len(set(evals)) == 1
     assert ast.evaluate_cached() is ast.evaluate_cached()
Esempio n. 2
0
    def test_dice_from_string(self):
        d = Dice.from_string('2d6')
        assert type(d) is Dice
        assert d.amount == 2 and d.sides == 6

        w = Dice.from_string('2w6')
        assert type(w) is WildDice
        assert w.amount == 2 and w.sides == 6

        u = Dice.from_string('2u6')
        assert type(u) is FudgeDice
        assert u.amount == 2 and u.sides == 6
Esempio n. 3
0
    def test_dice_from_string(self):
        d = Dice.from_string('2d6')
        assert type(d) is Dice
        assert d.amount == 2 and d.sides == 6

        w = Dice.from_string('2w6')
        assert type(w) is WildDice
        assert w.amount == 2 and w.sides == 6

        u = Dice.from_string('2u6')
        assert type(u) is FudgeDice
        assert u.amount == 2 and u.sides == 6
Esempio n. 4
0
 def test_cache(self):
     """Test that evaluation returns the same result on successive runs"""
     roll('6d(6d6)t')
     ast = Total(Dice(6, Dice(6, 6)))
     assert ast.evaluate_cached() is ast.evaluate_cached()
Esempio n. 5
0
 def test_dice_from_string(self):
     d = Dice.from_string('2d6')
     assert d.amount == 2 and d.sides == 6
Esempio n. 6
0
 def test_dice_from_iterable(self):
     d = Dice.from_iterable((2, 6))
     assert d.amount == 2 and d.sides == 6
Esempio n. 7
0
 def test_dice_from_iterable(self):
     d = Dice.from_iterable((2, 6))
     assert d.amount == 2 and d.sides == 6
Esempio n. 8
0
 def test_dice_from_string(self):
     d = Dice.from_string('2d6')
     assert d.amount == 2 and d.sides == 6
Esempio n. 9
0
 def test_dice_construct(self):
     d = Dice(2, 6)
     assert d.amount == 2 and d.amount == 2 and d.sides == d.max_value == 6
Esempio n. 10
0
 def test_nocache(self):
     """Test that evaluation returns different result on successive runs"""
     ast = Total(Dice(6, Dice(6, 6)))
     evals = [ast.evaluate() for i in range(100)]
     assert len(set(evals)) > 1