|
| 1 | +use examples_baseline::boost_type::BoostType; |
1 | 2 | use BoostType::{NullVal, KERS, NITROUS, SUPERCHARGER, TURBO}; |
2 | | -use examples_baseline::{ |
3 | | - boost_type::BoostType, |
4 | | -}; |
5 | 3 |
|
6 | 4 | #[test] |
7 | 5 | fn test_boost_type_from_str() -> Result<(), ()> { |
8 | | - assert_eq!("TURBO".parse::<BoostType>()?, TURBO, "Parse \"TURBO\" as BoostType"); |
9 | | - assert_eq!("SUPERCHARGER".parse::<BoostType>()?, SUPERCHARGER, "Parse \"SUPERCHARGER\" as BoostType"); |
10 | | - assert_eq!("NITROUS".parse::<BoostType>()?, NITROUS, "Parse \"NITROUS\" as BoostType"); |
11 | | - assert_eq!("KERS".parse::<BoostType>()?, KERS, "Parse \"KERS\" as BoostType"); |
| 6 | + assert_eq!( |
| 7 | + "TURBO".parse::<BoostType>()?, |
| 8 | + TURBO, |
| 9 | + "Parse \"TURBO\" as BoostType" |
| 10 | + ); |
| 11 | + assert_eq!( |
| 12 | + "SUPERCHARGER".parse::<BoostType>()?, |
| 13 | + SUPERCHARGER, |
| 14 | + "Parse \"SUPERCHARGER\" as BoostType" |
| 15 | + ); |
| 16 | + assert_eq!( |
| 17 | + "NITROUS".parse::<BoostType>()?, |
| 18 | + NITROUS, |
| 19 | + "Parse \"NITROUS\" as BoostType" |
| 20 | + ); |
| 21 | + assert_eq!( |
| 22 | + "KERS".parse::<BoostType>()?, |
| 23 | + KERS, |
| 24 | + "Parse \"KERS\" as BoostType" |
| 25 | + ); |
12 | 26 |
|
13 | | - assert_eq!("Turbo".parse::<BoostType>()?, NullVal, "Parse \"Turbo\" as BoostType"); |
14 | | - assert_eq!("Supercharger".parse::<BoostType>()?, NullVal, "Parse \"Supercharger\" as BoostType"); |
15 | | - assert_eq!("Nitrous".parse::<BoostType>()?, NullVal, "Parse \"Nitrous\" as BoostType"); |
16 | | - assert_eq!("Kers".parse::<BoostType>()?, NullVal, "Parse \"Kers\" as BoostType"); |
| 27 | + assert_eq!( |
| 28 | + "Turbo".parse::<BoostType>()?, |
| 29 | + NullVal, |
| 30 | + "Parse \"Turbo\" as BoostType" |
| 31 | + ); |
| 32 | + assert_eq!( |
| 33 | + "Supercharger".parse::<BoostType>()?, |
| 34 | + NullVal, |
| 35 | + "Parse \"Supercharger\" as BoostType" |
| 36 | + ); |
| 37 | + assert_eq!( |
| 38 | + "Nitrous".parse::<BoostType>()?, |
| 39 | + NullVal, |
| 40 | + "Parse \"Nitrous\" as BoostType" |
| 41 | + ); |
| 42 | + assert_eq!( |
| 43 | + "Kers".parse::<BoostType>()?, |
| 44 | + NullVal, |
| 45 | + "Parse \"Kers\" as BoostType" |
| 46 | + ); |
17 | 47 |
|
18 | | - assert_eq!("AA".parse::<BoostType>()?, NullVal, "Parse \"AA\" as BoostType"); |
19 | | - assert_eq!("".parse::<BoostType>().unwrap(), NullVal, "Parse \"\" as BoostType"); |
| 48 | + assert_eq!( |
| 49 | + "AA".parse::<BoostType>()?, |
| 50 | + NullVal, |
| 51 | + "Parse \"AA\" as BoostType" |
| 52 | + ); |
| 53 | + assert_eq!( |
| 54 | + "".parse::<BoostType>().unwrap(), |
| 55 | + NullVal, |
| 56 | + "Parse \"\" as BoostType" |
| 57 | + ); |
20 | 58 |
|
21 | 59 | Ok(()) |
22 | 60 | } |
0 commit comments