2022-04-10 14:08:30 +00:00
|
|
|
use leetcode::integer_to_roman::int_to_roman;
|
|
|
|
|
|
|
|
use test_case::test_case;
|
|
|
|
|
|
|
|
#[test_case(0, ""; "minimum")]
|
|
|
|
#[test_case(3999, "MMMCMXCIX"; "maximum")]
|
|
|
|
#[test_case(1666, "MDCLXVI"; "every character")]
|
2022-04-11 12:21:28 +00:00
|
|
|
#[test_case(1987, "MCMLXXXVII"; "all numbers 1")]
|
|
|
|
#[test_case(2654, "MMDCLIV"; "all numbers 2")]
|
|
|
|
#[test_case(321, "CCCXXI"; "all numbers 3")]
|
2022-04-10 14:08:30 +00:00
|
|
|
#[test_case(900, "CM"; "with subtracting")]
|
|
|
|
#[test_case(20, "XX"; "without subtracting")]
|
|
|
|
fn test_integer_to_roman(input: i32, expected: &str) {
|
|
|
|
assert_eq!(int_to_roman(input), expected);
|
|
|
|
}
|