1
Fork 0

Fix Clippy issues.

This commit is contained in:
Bauke 2024-01-25 13:21:29 +01:00
parent 32c834a292
commit 132d48a024
Signed by: Bauke
GPG Key ID: C1C0F29952BCF558
2 changed files with 38 additions and 38 deletions

View File

@ -2,16 +2,16 @@ use romantic::Roman;
use test_case::test_case; use test_case::test_case;
#[test_case(00, ""; "empty")] #[test_case(0, ""; "empty")]
#[test_case(01, "A"; "one")] #[test_case(1, "A"; "one")]
#[test_case(02, "AA"; "two")] #[test_case(2, "AA"; "two")]
#[test_case(03, "AAA"; "three")] #[test_case(3, "AAA"; "three")]
#[test_case(04, "AB"; "four")] #[test_case(4, "AB"; "four")]
#[test_case(05, "B"; "five")] #[test_case(5, "B"; "five")]
#[test_case(06, "BA"; "six")] #[test_case(6, "BA"; "six")]
#[test_case(07, "BAA"; "seven")] #[test_case(7, "BAA"; "seven")]
#[test_case(08, "BAAA"; "eight")] #[test_case(8, "BAAA"; "eight")]
#[test_case(09, "AC"; "nine")] #[test_case(9, "AC"; "nine")]
#[test_case(10, "C"; "ten")] #[test_case(10, "C"; "ten")]
fn test_to_string<T: num::PrimInt + num::Signed + ToString>( fn test_to_string<T: num::PrimInt + num::Signed + ToString>(
input: T, input: T,
@ -21,16 +21,16 @@ fn test_to_string<T: num::PrimInt + num::Signed + ToString>(
assert_eq!(custom.to_string(input).unwrap(), expected); assert_eq!(custom.to_string(input).unwrap(), expected);
} }
#[test_case("", 00; "empty")] #[test_case("", 0; "empty")]
#[test_case("A", 01; "one")] #[test_case("A", 1; "one")]
#[test_case("AA", 02; "two")] #[test_case("AA", 2; "two")]
#[test_case("AAA", 03; "three")] #[test_case("AAA", 3; "three")]
#[test_case("AB", 04; "four")] #[test_case("AB", 4; "four")]
#[test_case("B", 05; "five")] #[test_case("B", 5; "five")]
#[test_case("BA", 06; "six")] #[test_case("BA", 6; "six")]
#[test_case("BAA", 07; "seven")] #[test_case("BAA", 7; "seven")]
#[test_case("BAAA", 08; "eight")] #[test_case("BAAA", 8; "eight")]
#[test_case("AC", 09; "nine")] #[test_case("AC", 9; "nine")]
#[test_case("C", 10; "ten")] #[test_case("C", 10; "ten")]
fn test_from_str(input: &str, expected: i32) { fn test_from_str(input: &str, expected: i32) {
let custom = Roman::new(&['A', 'B', 'C', 'D']); let custom = Roman::new(&['A', 'B', 'C', 'D']);

View File

@ -5,15 +5,15 @@ use test_case::test_case;
#[test_case(0, ""; "empty")] #[test_case(0, ""; "empty")]
#[test_case(3888, "MMMDCCCLXXXVIII"; "all characters")] #[test_case(3888, "MMMDCCCLXXXVIII"; "all characters")]
#[test_case(3999, "MMMCMXCIX"; "maximum")] #[test_case(3999, "MMMCMXCIX"; "maximum")]
#[test_case(01, "I"; "one")] #[test_case(1, "I"; "one")]
#[test_case(02, "II"; "two")] #[test_case(2, "II"; "two")]
#[test_case(03, "III"; "three")] #[test_case(3, "III"; "three")]
#[test_case(04, "IV"; "four")] #[test_case(4, "IV"; "four")]
#[test_case(05, "V"; "five")] #[test_case(5, "V"; "five")]
#[test_case(06, "VI"; "six")] #[test_case(6, "VI"; "six")]
#[test_case(07, "VII"; "seven")] #[test_case(7, "VII"; "seven")]
#[test_case(08, "VIII"; "eight")] #[test_case(8, "VIII"; "eight")]
#[test_case(09, "IX"; "nine")] #[test_case(9, "IX"; "nine")]
#[test_case(10, "X"; "ten")] #[test_case(10, "X"; "ten")]
fn test_to_string<T: num::PrimInt + num::Signed + ToString>( fn test_to_string<T: num::PrimInt + num::Signed + ToString>(
input: T, input: T,
@ -25,15 +25,15 @@ fn test_to_string<T: num::PrimInt + num::Signed + ToString>(
#[test_case("", 0; "empty")] #[test_case("", 0; "empty")]
#[test_case("MMMDCCCLXXXVIII", 3888; "complicated")] #[test_case("MMMDCCCLXXXVIII", 3888; "complicated")]
#[test_case("MMMCMXCIX", 3999; "maximum")] #[test_case("MMMCMXCIX", 3999; "maximum")]
#[test_case("I", 01; "one")] #[test_case("I", 1; "one")]
#[test_case("II", 02; "two")] #[test_case("II", 2; "two")]
#[test_case("III", 03; "three")] #[test_case("III", 3; "three")]
#[test_case("IV", 04; "four")] #[test_case("IV", 4; "four")]
#[test_case("V", 05; "five")] #[test_case("V", 5; "five")]
#[test_case("VI", 06; "six")] #[test_case("VI", 6; "six")]
#[test_case("VII", 07; "seven")] #[test_case("VII", 7; "seven")]
#[test_case("VIII", 08; "eight")] #[test_case("VIII", 8; "eight")]
#[test_case("IX", 09; "nine")] #[test_case("IX", 9; "nine")]
#[test_case("X", 10; "ten")] #[test_case("X", 10; "ten")]
fn test_from_str(input: &str, expected: i32) { fn test_from_str(input: &str, expected: i32) {
assert_eq!(Roman::default().from_str::<i32>(input).unwrap(), expected); assert_eq!(Roman::default().from_str::<i32>(input).unwrap(), expected);