13 lines
371 B
Rust
13 lines
371 B
Rust
|
use leetcode::reverse_integer::reverse;
|
||
|
|
||
|
use test_case::test_case;
|
||
|
|
||
|
#[test_case(123, 321; "positive")]
|
||
|
#[test_case(-123, -321; "negative")]
|
||
|
#[test_case(1200, 21; "trailing zeroes")]
|
||
|
#[test_case(i32::MAX, 0; "overflow with max")]
|
||
|
#[test_case(i32::MIN, 0; "overflow with min")]
|
||
|
fn test_reverse_integer(input: i32, expected: i32) {
|
||
|
assert_eq!(reverse(input), expected);
|
||
|
}
|