1
Fork 0
leetcode/tests/reverse_integer.rs

13 lines
371 B
Rust
Raw Normal View History

2022-04-08 20:53:04 +00:00
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);
}