From 0bc6a5a9f57e210deb5d1399711f88bd63c3650c Mon Sep 17 00:00:00 2001 From: Shane Madden Date: Wed, 14 Aug 2024 14:54:14 -0600 Subject: [PATCH] attempt to fix tests, looks like bindgen broke our string enums though --- src/constants/types.rs | 79 +++++++++++------------------------------- 1 file changed, 21 insertions(+), 58 deletions(-) diff --git a/src/constants/types.rs b/src/constants/types.rs index 743ddfe2..eefa47cc 100644 --- a/src/constants/types.rs +++ b/src/constants/types.rs @@ -834,22 +834,18 @@ mod test { #[test] fn resources_rust_to_serde_json_from_serde_json_roundtrip() { for resource in enum_iterator::all::() { - if resource != ResourceType::__Nonexhaustive { - let serialized = serde_json::to_string(&resource).unwrap(); - let parsed: ResourceType = serde_json::from_str(&serialized).unwrap(); - assert_eq!(resource, parsed); - } + let serialized = serde_json::to_string(&resource).unwrap(); + let parsed: ResourceType = serde_json::from_str(&serialized).unwrap(); + assert_eq!(resource, parsed); } } #[test] fn resources_rust_to_display_from_str_roundtrip() { for resource in enum_iterator::all::() { - if resource != ResourceType::__Nonexhaustive { - let string = format!("{}", resource); - let parsed = ResourceType::from_str(&string).unwrap(); - assert_eq!(resource, parsed); - } + let string = format!("{}", resource); + let parsed = ResourceType::from_str(&string).unwrap(); + assert_eq!(resource, parsed); } } @@ -857,9 +853,7 @@ mod test { fn resources_rust_vec_to_serde_json_from_serde_json_roundtrip() { let mut resources = vec![]; for resource in enum_iterator::all::() { - if resource != ResourceType::__Nonexhaustive { - resources.push(resource); - } + resources.push(resource); } let serialized = serde_json::to_string(&resources).unwrap(); let resources_reparsed: Vec = serde_json::from_str(&serialized).unwrap(); @@ -870,9 +864,7 @@ mod test { fn resources_rust_vec_to_serde_json_from_serde_json_roundtrip_via_values() { let mut resources = vec![]; for resource in enum_iterator::all::() { - if resource != ResourceType::__Nonexhaustive { - resources.push(resource); - } + resources.push(resource); } let serialized = serde_json::to_string(&resources).unwrap(); let resources_reparsed_values: Vec = @@ -887,22 +879,18 @@ mod test { #[test] fn intershard_resources_rust_to_serde_json_from_serde_json_roundtrip() { for resource in enum_iterator::all::() { - if resource != IntershardResourceType::__Nonexhaustive { - let serialized = serde_json::to_string(&resource).unwrap(); - let parsed: IntershardResourceType = serde_json::from_str(&serialized).unwrap(); - assert_eq!(resource, parsed); - } + let serialized = serde_json::to_string(&resource).unwrap(); + let parsed: IntershardResourceType = serde_json::from_str(&serialized).unwrap(); + assert_eq!(resource, parsed); } } #[test] fn intershard_resources_rust_to_display_from_str_roundtrip() { for resource in enum_iterator::all::() { - if resource != IntershardResourceType::__Nonexhaustive { - let string = format!("{}", resource); - let parsed = IntershardResourceType::from_str(&string).unwrap(); - assert_eq!(resource, parsed); - } + let string = format!("{}", resource); + let parsed = IntershardResourceType::from_str(&string).unwrap(); + assert_eq!(resource, parsed); } } @@ -910,9 +898,7 @@ mod test { fn intershard_resources_rust_vec_to_serde_json_from_serde_json_roundtrip() { let mut resources = vec![]; for resource in enum_iterator::all::() { - if resource != IntershardResourceType::__Nonexhaustive { - resources.push(resource); - } + resources.push(resource); } let serialized = serde_json::to_string(&resources).unwrap(); let resources_reparsed: Vec = @@ -924,9 +910,7 @@ mod test { fn intershard_resources_rust_vec_to_serde_json_from_serde_json_roundtrip_via_values() { let mut resources = vec![]; for resource in enum_iterator::all::() { - if resource != IntershardResourceType::__Nonexhaustive { - resources.push(resource); - } + resources.push(resource); } let serialized = serde_json::to_string(&resources).unwrap(); let resources_reparsed_values: Vec = @@ -941,16 +925,9 @@ mod test { #[test] fn market_resources_rust_to_serde_json_from_serde_json_roundtrip() { for resource in enum_iterator::all::() { - if resource != MarketResourceType::Resource(ResourceType::__Nonexhaustive) - && resource - != MarketResourceType::IntershardResource( - IntershardResourceType::__Nonexhaustive, - ) - { - let serialized = serde_json::to_string(&resource).unwrap(); - let parsed: MarketResourceType = serde_json::from_str(&serialized).unwrap(); - assert_eq!(resource, parsed); - } + let serialized = serde_json::to_string(&resource).unwrap(); + let parsed: MarketResourceType = serde_json::from_str(&serialized).unwrap(); + assert_eq!(resource, parsed); } } @@ -958,14 +935,7 @@ mod test { fn market_resources_rust_vec_to_serde_json_from_serde_json_roundtrip() { let mut resources = vec![]; for resource in enum_iterator::all::() { - if resource != MarketResourceType::Resource(ResourceType::__Nonexhaustive) - && resource - != MarketResourceType::IntershardResource( - IntershardResourceType::__Nonexhaustive, - ) - { - resources.push(resource); - } + resources.push(resource); } let serialized = serde_json::to_string(&resources).unwrap(); let resources_reparsed: Vec = @@ -977,14 +947,7 @@ mod test { fn market_resources_rust_vec_to_serde_json_from_serde_json_roundtrip_via_values() { let mut resources = vec![]; for resource in enum_iterator::all::() { - if resource != MarketResourceType::Resource(ResourceType::__Nonexhaustive) - && resource - != MarketResourceType::IntershardResource( - IntershardResourceType::__Nonexhaustive, - ) - { - resources.push(resource); - } + resources.push(resource); } let serialized = serde_json::to_string(&resources).unwrap(); let resources_reparsed_values: Vec =