mirror of
https://github.com/dmuth/diceware.git
synced 2024-11-23 17:26:34 -05:00
Now testing getBase6()
This commit is contained in:
parent
3f1661281c
commit
544f504bd3
1 changed files with 34 additions and 3 deletions
|
@ -7,9 +7,9 @@ var Promise = require("bluebird");
|
|||
var diceware = require("../src/lib.js")
|
||||
|
||||
|
||||
|
||||
describe("Diceware", function() {
|
||||
describe("getRandomValue()", function(done) {
|
||||
|
||||
describe("getRandomValue()", function() {
|
||||
|
||||
it("Should pass", function(done) {
|
||||
|
||||
|
@ -42,13 +42,44 @@ describe("Diceware", function() {
|
|||
});
|
||||
|
||||
});
|
||||
|
||||
|
||||
describe("getBase6()", function() {
|
||||
it("Better pass", function() {
|
||||
|
||||
diceware.getBase6(0, 1).should.containDeepOrdered([0]);
|
||||
diceware.getBase6(1, 1).should.containDeepOrdered([1]);
|
||||
diceware.getBase6(5, 1).should.containDeepOrdered([5]);
|
||||
diceware.getBase6(6, 2).should.containDeepOrdered([1, 0]);
|
||||
diceware.getBase6(12, 2).should.containDeepOrdered([2, 0]);
|
||||
diceware.getBase6(35, 2).should.containDeepOrdered([5, 5]);
|
||||
diceware.getBase6(36, 3).should.containDeepOrdered([1, 0, 0]);
|
||||
diceware.getBase6(180, 3).should.containDeepOrdered([5, 0, 0]);
|
||||
diceware.getBase6(215, 3).should.containDeepOrdered([5, 5, 5]);
|
||||
diceware.getBase6(216, 4).should.containDeepOrdered([1, 0, 0, 0]);
|
||||
diceware.getBase6(1080, 4).should.containDeepOrdered([5, 0, 0, 0]);
|
||||
diceware.getBase6(1295, 4).should.containDeepOrdered([5, 5, 5, 5]);
|
||||
diceware.getBase6(7775, 5).should.containDeepOrdered([5, 5, 5, 5, 5]);
|
||||
diceware.getBase6(46655, 6).should.containDeepOrdered([5, 5, 5, 5, 5, 5]);
|
||||
diceware.getBase6(279935, 7).should.containDeepOrdered([5, 5, 5, 5, 5, 5, 5]);
|
||||
diceware.getBase6(1679615, 8).should.containDeepOrdered([5, 5, 5, 5, 5, 5, 5, 5]);
|
||||
|
||||
should.throws(function() { diceware.getBase6(6, 1) }, /Value too large/);
|
||||
should.throws(function() { diceware.getBase6(36, 2) }, /Value too large/);
|
||||
should.throws(function() { diceware.getBase6(216, 3) }, /Value too large/);
|
||||
should.throws(function() { diceware.getBase6(-1, 1) }, /Value cannot be negative/);
|
||||
|
||||
});
|
||||
});
|
||||
|
||||
|
||||
});
|
||||
|
||||
|
||||
/*
|
||||
TEST/TODO: Things to refactor:
|
||||
X Diceware.getRandomValue
|
||||
- Diceware.getBase6
|
||||
X Diceware.getBase6
|
||||
- Diceware.convertBase6ToDice
|
||||
- Diceware.getNumValuesFromNumDice
|
||||
- Diceware.rollDice(1).roll.length
|
||||
|
|
Loading…
Reference in a new issue