dice: more tests of the cypher roll string

Signed-off-by: Brian S. Stephan <bss@incorporeal.org>
This commit is contained in:
2026-07-24 10:41:19 -05:00
parent 533a74db6d
commit e0ae5335f4
+28
View File
@@ -135,3 +135,31 @@ class CypherRollStringTestCase(TestCase):
_, _, _, _, _, _, _, result = dice.lib.cypher_result(difficulty=3, mod=0, stat="Might",
comment="Test")
self.assertEqual(result, "Test Might roll succeeded! (result 3 (d20=10) vs. difficulty 3 (3))")
def test_intrusion_result(self):
"""Test the result of an intrusion."""
with mock.patch('random.SystemRandom.randint', return_value=1):
_, _, _, _, _, _, _, result = dice.lib.cypher_result(difficulty=3, mod=0, stat="Might",
comment="Test")
self.assertEqual(result, "Test Might roll failed, with a GM intrusion! (result 0 (d20=1) vs. difficulty 3 (3))")
def test_unknown_difficulty(self):
"""Test the output when the difficulty is unknown."""
with mock.patch('random.SystemRandom.randint', return_value=10):
_, _, _, _, _, _, _, result = dice.lib.cypher_result(mod=0, stat="Might",
comment="Test")
self.assertEqual(result, "Test Might roll beats a difficulty 3 task. (result 3 (d20=10))")
def test_unknown_difficulty_intrusion(self):
"""Test the output when the difficulty is unknown."""
with mock.patch('random.SystemRandom.randint', return_value=1):
_, _, _, _, _, _, _, result = dice.lib.cypher_result(mod=0, stat="Might",
comment="Test")
self.assertEqual(result, "Test Might roll beats nothing, with a GM intrusion! (result 0 (d20=1))")
def test_unknown_difficulty_effect(self):
"""Test the output when the difficulty is unknown."""
with mock.patch('random.SystemRandom.randint', return_value=20):
_, _, _, _, _, _, _, result = dice.lib.cypher_result(mod=0, stat="Might",
comment="Test")
self.assertEqual(result, "Test Might roll beats a difficulty 6 task, with a MAJOR EFFECT! (result 6 (d20=20))")