-
-
Notifications
You must be signed in to change notification settings - Fork 3.9k
Add beginning of complex serialization / deserialization tests (#6834) #7336
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: main
Are you sure you want to change the base?
Conversation
tests/scenes/components.rs
Outdated
.write_to_world(&mut output_app.world, &mut entity_map) | ||
.unwrap_or_else(|error| panic!("Could not add deserialized scene to world: {error}")); | ||
|
||
// TODO (Wybe 2023-01-22): Ideally we'd check whether the input and output world are exactly equal. But the world does not implement Eq. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
// TODO (Wybe 2023-01-22): Ideally we'd check whether the input and output world are exactly equal. But the world does not implement Eq. | |
// TODO: Ideally we'd check whether the input and output world are exactly equal. But the world does not implement Eq. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Whoops, I have a thing that auto-inserts the name and date, should probably disable that for open source projects 😄
tests/scenes/components.rs
Outdated
.register_type::<Option<Entity>>() | ||
.register_type::<VectorComponent>() | ||
.register_type::<TupleComponent>() | ||
// TODO (Wcubed 2023-01-22): Without the `Vec` registrations, the serialization |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
// TODO (Wcubed 2023-01-22): Without the `Vec` registrations, the serialization | |
// TODO: Without the `Vec` registrations, the serialization |
tests/scenes/components.rs
Outdated
// Either both should fail, or both should work. | ||
.register_type::<Vec<u32>>() | ||
.register_type::<Vec<String>>() | ||
// TODO (Wcubed 2023-01-22): Without these tuple registrations, the serialization |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
// TODO (Wcubed 2023-01-22): Without these tuple registrations, the serialization | |
// TODO: Without these tuple registrations, the serialization |
0883a36
to
528eff1
Compare
I created a separate crate for adding integration tests, so we can separate out the dependencies for the integration tests with those for the examples. I was not sure whether to put the tests all in the src directory, or all in the |
5341fcb
to
c64a8c2
Compare
Rebased upon current master. |
let scene = DynamicScene::from_world(&input_app.world, type_registry); | ||
let serialized_again = serialize(scene, type_registry); | ||
|
||
assert_eq!(serialized, serialized_again); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
maybe you can also check the size of entity_map
after the call to write_to_world
?
@Wcubed are you still interested in this? If so, can you fix the merge conflicts? |
Certainly, I will have a go at it this week |
c64a8c2
to
e4b39ba
Compare
Updated to 0.16 |
The generated |
Objective
Lay down the basis for catching serialization / deserialization bugs, such as those listed in #6834.
Solution
Added a backend-agnostic roundtrip test, along with implementations for ron, postcard, bincode and messagepack.