MCPcopy Create free account
hub / github.com/sergi/go-diff / TestDiffCleanupEfficiency

Function TestDiffCleanupEfficiency

diffmatchpatch/diff_test.go:886–990  ·  view source on GitHub ↗
(t *testing.T)

Source from the content-addressed store, hash-verified

884}
885
886func TestDiffCleanupEfficiency(t *testing.T) {
887 type TestCase struct {
888 Name string
889
890 Diffs []Diff
891
892 Expected []Diff
893 }
894
895 dmp := New()
896 dmp.DiffEditCost = 4
897
898 for i, tc := range []TestCase{
899 {
900 "Null case",
901 []Diff{},
902 []Diff{},
903 },
904 {
905 "No elimination",
906 []Diff{
907 Diff{DiffDelete, "ab"},
908 Diff{DiffInsert, "12"},
909 Diff{DiffEqual, "wxyz"},
910 Diff{DiffDelete, "cd"},
911 Diff{DiffInsert, "34"},
912 },
913 []Diff{
914 Diff{DiffDelete, "ab"},
915 Diff{DiffInsert, "12"},
916 Diff{DiffEqual, "wxyz"},
917 Diff{DiffDelete, "cd"},
918 Diff{DiffInsert, "34"},
919 },
920 },
921 {
922 "Four-edit elimination",
923 []Diff{
924 Diff{DiffDelete, "ab"},
925 Diff{DiffInsert, "12"},
926 Diff{DiffEqual, "xyz"},
927 Diff{DiffDelete, "cd"},
928 Diff{DiffInsert, "34"},
929 },
930 []Diff{
931 Diff{DiffDelete, "abxyzcd"},
932 Diff{DiffInsert, "12xyz34"},
933 },
934 },
935 {
936 "Three-edit elimination",
937 []Diff{
938 Diff{DiffInsert, "12"},
939 Diff{DiffEqual, "x"},
940 Diff{DiffDelete, "cd"},
941 Diff{DiffInsert, "34"},
942 },
943 []Diff{

Callers

nothing calls this directly

Calls 2

NewFunction · 0.85
DiffCleanupEfficiencyMethod · 0.80

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…