30 lines
699 B
Python
30 lines
699 B
Python
|
from roll.throw import Throw
|
||
|
|
||
|
|
||
|
def test_throw():
|
||
|
throw = Throw([1, 2, 3], sides=4)
|
||
|
assert throw.total == 6
|
||
|
assert not throw.is_critical_hit
|
||
|
assert not throw.is_critical_miss
|
||
|
|
||
|
|
||
|
def test_throw_with_modifier():
|
||
|
throw = Throw([1, 2, 3], sides=4, modifier=5)
|
||
|
assert throw.total == 11
|
||
|
assert not throw.is_critical_hit
|
||
|
assert not throw.is_critical_miss
|
||
|
|
||
|
|
||
|
def test_critical_hit():
|
||
|
throw = Throw([20], sides=20)
|
||
|
assert throw.total == 20
|
||
|
assert throw.is_critical_hit
|
||
|
assert not throw.is_critical_miss
|
||
|
|
||
|
|
||
|
def test_critical_miss():
|
||
|
throw = Throw([1], sides=20)
|
||
|
assert throw.total == 1
|
||
|
assert not throw.is_critical_hit
|
||
|
assert throw.is_critical_miss
|