forked from NiSLa-NiSlimeTRPG/BCDice_N
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathtest_d66_table.rb
147 lines (127 loc) · 3 KB
/
test_d66_table.rb
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
# frozen_string_literal: true
require "test/unit"
require "bcdice"
require "bcdice/dice_table/d66_table"
require_relative "randomizer_mock"
class TestD66Table < Test::Unit::TestCase
def setup
@asc_items = {
11 => "あ",
12 => "い",
13 => "う",
14 => "え",
15 => "お",
16 => "か",
22 => "き",
23 => "く",
24 => "け",
25 => "こ",
26 => "さ",
33 => "し",
34 => "す",
35 => "せ",
36 => "そ",
44 => "た",
45 => "ち",
46 => "つ",
55 => "て",
56 => "と",
66 => "な",
}
@desc_items = {
11 => "に",
21 => "ぬ",
22 => "ね",
31 => "の",
32 => "は",
33 => "ひ",
41 => "ふ",
42 => "へ",
43 => "ほ",
44 => "ま",
51 => "み",
52 => "む",
53 => "め",
54 => "も",
55 => "や",
61 => "ゆ",
62 => "よ",
63 => "ら",
64 => "り",
65 => "る",
66 => "れ",
}
end
def test_asc
table = BCDice::DiceTable::D66Table.new(
"テスト",
:asc,
@asc_items
)
randomizer = RandomizerMock.new([[1, 6], [6, 6]])
assert_equal("テスト(16) > か", table.roll(randomizer).to_s)
end
def test_asc_swap
table = BCDice::DiceTable::D66Table.new(
"テスト",
:asc,
@asc_items
)
randomizer = RandomizerMock.new([[6, 6], [1, 6]])
assert_equal("テスト(16) > か", table.roll(randomizer).to_s)
end
def test_asc_11
table = BCDice::DiceTable::D66Table.new(
"テスト",
:asc,
@asc_items
)
randomizer = RandomizerMock.new([[1, 6], [1, 6]])
assert_equal("テスト(11) > あ", table.roll(randomizer).to_s)
end
def test_asc_66
table = BCDice::DiceTable::D66Table.new(
"テスト",
:asc,
@asc_items
)
randomizer = RandomizerMock.new([[6, 6], [6, 6]])
assert_equal("テスト(66) > な", table.roll(randomizer).to_s)
end
def test_desc
table = BCDice::DiceTable::D66Table.new(
"テスト",
:desc,
@desc_items
)
randomizer = RandomizerMock.new([[6, 6], [1, 6]])
assert_equal("テスト(61) > ゆ", table.roll(randomizer).to_s)
end
def test_desc_swap
table = BCDice::DiceTable::D66Table.new(
"テスト",
:desc,
@desc_items
)
randomizer = RandomizerMock.new([[1, 6], [6, 6]])
assert_equal("テスト(61) > ゆ", table.roll(randomizer).to_s)
end
def test_desc_11
table = BCDice::DiceTable::D66Table.new(
"テスト",
:desc,
@desc_items
)
randomizer = RandomizerMock.new([[1, 6], [1, 6]])
assert_equal("テスト(11) > に", table.roll(randomizer).to_s)
end
def test_desc_66
table = BCDice::DiceTable::D66Table.new(
"テスト",
:desc,
@desc_items
)
randomizer = RandomizerMock.new([[6, 6], [6, 6]])
assert_equal("テスト(66) > れ", table.roll(randomizer).to_s)
end
end