6
Test.add_func ("/VQDR/Expression/Dice/d6/to_string1", () => {
8
if (!(d.to_string () == "1d6")) {
10
Test.message ("The string does not match the expected value.");
14
Test.add_func ("/VQDR/Expression/Dice/d6/to_string2", () => {
15
Dice d = new Dice (5,6);
16
if (!(d.to_string () == "5d6")) {
18
Test.message ("The string does not match the expected value.");
22
Test.add_func ("/VQDR/Expression/Dice/d6/to_string3", () => {
23
Dice d = new Dice (1,6,4);
24
if (!(d.to_string () == "1d6+4")) {
26
Test.message ("The string does not match the expected value.");
30
Test.add_func ("/VQDR/Expression/Dice/d6/to_string4", () => {
31
Dice d = new Dice (1,6,-4);
32
if (!(d.to_string () == "1d6-4")) {
34
Test.message ("The string does not match the expected value.");
38
Test.add_func ("/VQDR/Expression/Dice/d6/roll_count", () => {
42
for (size_t i = 0; i < rolls; i++) {
48
for (int i = 0; i < 6; i++) {
52
if (!(total == rolls)) {
54
Test.message ("Rolles do not add up.");
58
Test.add_func ("/VQDR/Expression/Dice/d6/roll_probability", () => {
62
for (size_t i = 0; i < rolls; i++) {
67
for (int i = 0; i < 6; i++) {
68
print ("------------\n");
69
print ("count for %d : %\n", i + 1, count[i] );
70
double procentile = ((double )count[i] / rolls) * 100;
71
if ((procentile < 15) || (procentile > 17)) {
72
// The value sholud be aronud 16 %
73
Test.message ("Procentile of D6 is off. Expected close to 16 %% got %f", procentile);
76
print ("chance for %d : %f %%\n", i, procentile );