m-chrzan.xyz
aboutsummaryrefslogtreecommitdiff
path: root/__tests__
diff options
context:
space:
mode:
authorMarcin Chrzanowski <marcin.j.chrzanowski@gmail.com>2017-08-23 21:26:01 -0400
committerMarcin Chrzanowski <marcin.j.chrzanowski@gmail.com>2017-08-23 21:26:01 -0400
commit5bb027bde84e0a8fdb01bfa680b511ad842498ef (patch)
tree50c5c31b11986927f165f14804376ed6506ca609 /__tests__
parent51748970426496823600522f5cfda65240d6e6e8 (diff)
Implement threshold
Diffstat (limited to '__tests__')
-rw-r--r--__tests__/dice.test.js25
1 files changed, 24 insertions, 1 deletions
diff --git a/__tests__/dice.test.js b/__tests__/dice.test.js
index a18584c..12d9130 100644
--- a/__tests__/dice.test.js
+++ b/__tests__/dice.test.js
@@ -10,7 +10,8 @@ const {
explode,
keepHigh,
keepLow,
- again
+ again,
+ threshold
} = require('../src/dice.js')
const defaultNumberRolls = 500
@@ -560,3 +561,25 @@ describe('again', () => {
})
})
})
+
+describe('threshold', () => {
+ describe('8T3d10', () => {
+ const die = threshold(constant(8), d(constant(3), constant(10)))
+
+ testDie(die, {
+ diceCount: 3,
+ average: {
+ average: 0.9
+ },
+ variance: {
+ variance: 0.63
+ },
+ bounds: {
+ low: 0,
+ high: 3,
+ expectLow: true,
+ expectHigh: true
+ }
+ })
+ })
+})