File tree 1 file changed +30
-0
lines changed
1 file changed +30
-0
lines changed Original file line number Diff line number Diff line change @@ -164,3 +164,33 @@ fn ilog10_u64() {
164
164
fn ilog10_u128 ( ) {
165
165
ilog10_loop ! { u128 , 38 }
166
166
}
167
+
168
+ #[ test]
169
+ #[ should_panic( expected = "argument of integer logarithm must be positive" ) ]
170
+ fn ilog2_of_0_panic ( ) {
171
+ let _ = 0u32 . ilog2 ( ) ;
172
+ }
173
+
174
+ #[ test]
175
+ #[ should_panic( expected = "argument of integer logarithm must be positive" ) ]
176
+ fn ilog10_of_0_panic ( ) {
177
+ let _ = 0u32 . ilog10 ( ) ;
178
+ }
179
+
180
+ #[ test]
181
+ #[ should_panic( expected = "argument of integer logarithm must be positive" ) ]
182
+ fn ilog3_of_0_panic ( ) {
183
+ let _ = 0u32 . ilog ( 3 ) ;
184
+ }
185
+
186
+ #[ test]
187
+ #[ should_panic( expected = "base of integer logarithm must be at least 2" ) ]
188
+ fn ilog0_of_1_panic ( ) {
189
+ let _ = 1u32 . ilog ( 0 ) ;
190
+ }
191
+
192
+ #[ test]
193
+ #[ should_panic( expected = "base of integer logarithm must be at least 2" ) ]
194
+ fn ilog1_of_1_panic ( ) {
195
+ let _ = 1u32 . ilog ( 1 ) ;
196
+ }
You can’t perform that action at this time.
0 commit comments