コード例 #1
0
 def test_only_ops(self):
     Throw('+ + +')
コード例 #2
0
 def test_empty(self):
     Throw('')
コード例 #3
0
 def test_bad_characters(self):
     Throw('@ + 3 + 3')
コード例 #4
0
 def test_missing_ops(self):
     Throw('3 3 + 3')
コード例 #5
0
 def test_ooo_2(self):
     throw = Throw('1 * 2 - 3 + 4 / 5')
     return_value = throw.roll()
     assert_almost_equal(-0.2, return_value)
コード例 #6
0
 def test_throw_complex(self):
     throw = Throw('1d4 * 2 + 1d6 - 1 + 1d4 / 2')
     min_value = 1 * 2 + 1 - 1 + 1 / 2
     max_value = 4 * 2 + 6 - 1 + 4 / 2
     return_value = throw.roll()
     assert_true(min_value <= return_value <= max_value)
コード例 #7
0
 def test_ooo_1(self):
     throw = Throw('1 + 2 - 3 * 4 / 5')
     return_value = throw.roll()
     assert_almost_equal(0.6, return_value)
コード例 #8
0
 def test_throw_multiroll(self):
     throw = Throw('1d1 + 1d1')
     return_value = throw.roll()
     assert_equal(2, return_value)
コード例 #9
0
 def test_throw_multiplication(self):
     throw = Throw('1d1 * 3')
     return_value = throw.roll()
     assert_equal(3, return_value)
コード例 #10
0
 def test_throw_addition(self):
     throw = Throw('1d1 + 1')
     return_value = throw.roll()
     assert_equal(2, return_value)
コード例 #11
0
 def test_throw_dn(self):
     for n in range(1, 21):
         throw = Throw(f'1d{n}')
         return_value = throw.roll()
         assert_true(1 <= return_value <= n)