wiggle: use bitflags to generate flags

more consistient with the rest of the ecosystem.
This commit is contained in:
Pat Hickey
2021-01-11 18:20:57 -08:00
parent e2fb99af86
commit ed44a19e5e
2 changed files with 15 additions and 86 deletions

View File

@@ -103,11 +103,11 @@ proptest! {
#[test]
fn flags_fmt() {
let empty = format!("{}", types::CarConfig::empty());
assert_eq!(empty, "empty (0x0)");
assert_eq!(empty, "CarConfig((empty) (0x0))");
let one_flag = format!("{}", types::CarConfig::AWD);
assert_eq!(one_flag, "awd (0x2)");
assert_eq!(one_flag, "CarConfig(AWD (0x2))");
let two_flags = format!("{}", types::CarConfig::AUTOMATIC | types::CarConfig::SUV);
assert_eq!(two_flags, "automatic|suv (0x5)");
assert_eq!(two_flags, "CarConfig(AUTOMATIC | SUV (0x5))");
let all = format!("{}", types::CarConfig::all());
assert_eq!(all, "automatic|awd|suv (0x7)");
assert_eq!(all, "CarConfig(AUTOMATIC | AWD | SUV (0x7))");
}