MCPcopy Create free account
hub / github.com/BillyDM/Firewheel / test_simple_diff

Function test_simple_diff

crates/firewheel-core/src/diff/mod.rs:738–759  ·  view source on GitHub ↗
()

Source from the content-addressed store, hash-verified

736 a.diff(&b, PathBuilder::default(), &mut patches);
737
738 assert_eq!(patches.len(), 1);
739
740 for patch in patches.iter() {
741 let patch = StructDiff::patch_event(patch).unwrap();
742
743 assert!(matches!(patch, StructDiffPatch::A(a) if a == 0.5));
744
745 b.apply(patch);
746 }
747
748 assert_eq!(a, b);
749 }
750
751 #[derive(Debug, Clone, Diff, Patch, PartialEq)]
752 enum DiffingExample {
753 Unit,
754 Tuple(f32, f32),
755 Struct { a: f32, b: f32 },
756 }
757
758 #[test]
759 fn test_enum_diff() {
760 let mut baseline = DiffingExample::Tuple(1.0, 0.0);
761 let value = DiffingExample::Tuple(1.0, 1.0);
762

Callers

nothing calls this directly

Calls 3

cloneMethod · 0.45
diffMethod · 0.45
applyMethod · 0.45

Tested by

no test coverage detected