@@ -11,8 +11,8 @@ def test_single_bit_one_to_decimal
1111
1212 converted = BaseConverter . convert ( input_base , digits , output_base )
1313
14- hint = "Input base: 2 , output base 10 . " \
15- "Expected #{ expected } but got #{ converted } ."
14+ hint = "Input base: #{ input_base } , output base #{ output_base } . " \
15+ "Expected #{ expected } but got #{ converted } ."
1616
1717 assert_equal expected , converted , hint
1818 end
@@ -26,8 +26,8 @@ def test_binary_to_single_decimal
2626
2727 converted = BaseConverter . convert ( input_base , digits , output_base )
2828
29- hint = "Input base: 2 , output base 10 . " \
30- "Expected #{ expected } but got #{ converted } ."
29+ hint = "Input base: #{ input_base } , output base #{ output_base } . " \
30+ "Expected #{ expected } but got #{ converted } ."
3131
3232 assert_equal expected , converted , hint
3333 end
@@ -41,8 +41,8 @@ def test_single_decimal_to_binary
4141
4242 converted = BaseConverter . convert ( input_base , digits , output_base )
4343
44- hint = "Input base: 10 , output base 2 . " \
45- "Expected #{ expected } but got #{ converted } ."
44+ hint = "Input base: #{ input_base } , output base #{ output_base } . " \
45+ "Expected #{ expected } but got #{ converted } ."
4646
4747 assert_equal expected , converted , hint
4848 end
@@ -56,8 +56,8 @@ def test_binary_to_multiple_decimal
5656
5757 converted = BaseConverter . convert ( input_base , digits , output_base )
5858
59- hint = "Input base: 2 , output base 10 . " \
60- "Expected #{ expected } but got #{ converted } ."
59+ hint = "Input base: #{ input_base } , output base #{ output_base } . " \
60+ "Expected #{ expected } but got #{ converted } ."
6161
6262 assert_equal expected , converted , hint
6363 end
@@ -71,8 +71,8 @@ def test_decimal_to_binary
7171
7272 converted = BaseConverter . convert ( input_base , digits , output_base )
7373
74- hint = "Input base: 10 , output base 2 . " \
75- "Expected #{ expected } but got #{ converted } ."
74+ hint = "Input base: #{ input_base } , output base #{ output_base } . " \
75+ "Expected #{ expected } but got #{ converted } ."
7676
7777 assert_equal expected , converted , hint
7878 end
@@ -86,8 +86,8 @@ def test_trinary_to_hexadecimal
8686
8787 converted = BaseConverter . convert ( input_base , digits , output_base )
8888
89- hint = "Input base: 3 , output base 16 . " \
90- "Expected #{ expected } but got #{ converted } ."
89+ hint = "Input base: #{ input_base } , output base #{ output_base } . " \
90+ "Expected #{ expected } but got #{ converted } ."
9191
9292 assert_equal expected , converted , hint
9393 end
@@ -101,8 +101,8 @@ def test_hexadecimal_to_trinary
101101
102102 converted = BaseConverter . convert ( input_base , digits , output_base )
103103
104- hint = "Input base: 16 , output base 3 . " \
105- "Expected #{ expected } but got #{ converted } ."
104+ hint = "Input base: #{ input_base } , output base #{ output_base } . " \
105+ "Expected #{ expected } but got #{ converted } ."
106106
107107 assert_equal expected , converted , hint
108108 end
@@ -116,8 +116,8 @@ def test_15_bit_integer
116116
117117 converted = BaseConverter . convert ( input_base , digits , output_base )
118118
119- hint = "Input base: 97 , output base 73 . " \
120- "Expected #{ expected } but got #{ converted } ."
119+ hint = "Input base: #{ input_base } , output base #{ output_base } . " \
120+ "Expected #{ expected } but got #{ converted } ."
121121
122122 assert_equal expected , converted , hint
123123 end
@@ -131,8 +131,8 @@ def test_empty_list
131131
132132 converted = BaseConverter . convert ( input_base , digits , output_base )
133133
134- hint = "Input base: 2 , output base 10 . " \
135- "Expected #{ expected } but got #{ converted } ."
134+ hint = "Input base: #{ input_base } , output base #{ output_base } . " \
135+ "Expected #{ expected } but got #{ converted } ."
136136
137137 assert_equal expected , converted , hint
138138 end
@@ -146,8 +146,8 @@ def test_single_zero
146146
147147 converted = BaseConverter . convert ( input_base , digits , output_base )
148148
149- hint = "Input base: 10 , output base 2 . " \
150- "Expected #{ expected } but got #{ converted } ."
149+ hint = "Input base: #{ input_base } , output base #{ output_base } . " \
150+ "Expected #{ expected } but got #{ converted } ."
151151
152152 assert_equal expected , converted , hint
153153 end
@@ -161,8 +161,8 @@ def test_multiple_zeros
161161
162162 converted = BaseConverter . convert ( input_base , digits , output_base )
163163
164- hint = "Input base: 10 , output base 2 . " \
165- "Expected #{ expected } but got #{ converted } ."
164+ hint = "Input base: #{ input_base } , output base #{ output_base } . " \
165+ "Expected #{ expected } but got #{ converted } ."
166166
167167 assert_equal expected , converted , hint
168168 end
@@ -176,8 +176,8 @@ def test_leading_zeros
176176
177177 converted = BaseConverter . convert ( input_base , digits , output_base )
178178
179- hint = "Input base: 7 , output base 10 . " \
180- "Expected #{ expected } but got #{ converted } ."
179+ hint = "Input base: #{ input_base } , output base #{ output_base } . " \
180+ "Expected #{ expected } but got #{ converted } ."
181181
182182 assert_equal expected , converted , hint
183183 end
@@ -187,6 +187,7 @@ def test_input_base_is_one
187187 digits = [ 0 ]
188188 input_base = 1
189189 output_base = 10
190+
190191 assert_raises ( ArgumentError ) do
191192 BaseConverter . convert ( input_base , digits , output_base )
192193 end
@@ -197,6 +198,7 @@ def test_input_base_is_zero
197198 digits = [ ]
198199 input_base = 0
199200 output_base = 10
201+
200202 assert_raises ( ArgumentError ) do
201203 BaseConverter . convert ( input_base , digits , output_base )
202204 end
@@ -207,6 +209,7 @@ def test_input_base_is_negative
207209 digits = [ 1 ]
208210 input_base = -2
209211 output_base = 10
212+
210213 assert_raises ( ArgumentError ) do
211214 BaseConverter . convert ( input_base , digits , output_base )
212215 end
@@ -217,6 +220,7 @@ def test_negative_digit
217220 digits = [ 1 , -1 , 1 , 0 , 1 , 0 ]
218221 input_base = 2
219222 output_base = 10
223+
220224 assert_raises ( ArgumentError ) do
221225 BaseConverter . convert ( input_base , digits , output_base )
222226 end
@@ -227,6 +231,7 @@ def test_invalid_positive_digit
227231 digits = [ 1 , 2 , 1 , 0 , 1 , 0 ]
228232 input_base = 2
229233 output_base = 10
234+
230235 assert_raises ( ArgumentError ) do
231236 BaseConverter . convert ( input_base , digits , output_base )
232237 end
@@ -237,6 +242,7 @@ def test_output_base_is_one
237242 digits = [ 1 , 0 , 1 , 0 , 1 , 0 ]
238243 input_base = 2
239244 output_base = 1
245+
240246 assert_raises ( ArgumentError ) do
241247 BaseConverter . convert ( input_base , digits , output_base )
242248 end
@@ -247,6 +253,7 @@ def test_output_base_is_zero
247253 digits = [ 7 ]
248254 input_base = 10
249255 output_base = 0
256+
250257 assert_raises ( ArgumentError ) do
251258 BaseConverter . convert ( input_base , digits , output_base )
252259 end
@@ -257,6 +264,7 @@ def test_output_base_is_negative
257264 digits = [ 1 ]
258265 input_base = 2
259266 output_base = -7
267+
260268 assert_raises ( ArgumentError ) do
261269 BaseConverter . convert ( input_base , digits , output_base )
262270 end
@@ -267,6 +275,7 @@ def test_both_bases_are_negative
267275 digits = [ 1 ]
268276 input_base = -2
269277 output_base = -7
278+
270279 assert_raises ( ArgumentError ) do
271280 BaseConverter . convert ( input_base , digits , output_base )
272281 end
0 commit comments