MCPcopy Create free account
hub / github.com/cogentcore/core / TestWithAsciiOneInsert

Function TestWithAsciiOneInsert

texteditor/difflib/difflib_test.go:224–238  ·  view source on GitHub ↗
(t *testing.T)

Source from the content-addressed store, hash-verified

222}
223
224func TestWithAsciiOneInsert(t *testing.T) {
225 sm := NewMatcher(splitChars(rep("b", 100)),
226 splitChars("a"+rep("b", 100)))
227 assertAlmostEqual(t, sm.Ratio(), 0.995, 3)
228 assertEqual(t, sm.GetOpCodes(),
229 []OpCode{{'i', 0, 0, 0, 1}, {'e', 0, 100, 1, 101}})
230 assertEqual(t, len(sm.bPopular), 0)
231
232 sm = NewMatcher(splitChars(rep("b", 100)),
233 splitChars(rep("b", 50)+"a"+rep("b", 50)))
234 assertAlmostEqual(t, sm.Ratio(), 0.995, 3)
235 assertEqual(t, sm.GetOpCodes(),
236 []OpCode{{'e', 0, 50, 0, 50}, {'i', 50, 50, 50, 51}, {'e', 50, 100, 51, 101}})
237 assertEqual(t, len(sm.bPopular), 0)
238}
239
240func TestWithAsciiOnDelete(t *testing.T) {
241 sm := NewMatcher(splitChars(rep("a", 40)+"c"+rep("b", 40)),

Callers

nothing calls this directly

Calls 7

NewMatcherFunction · 0.70
splitCharsFunction · 0.70
repFunction · 0.70
assertAlmostEqualFunction · 0.70
assertEqualFunction · 0.70
RatioMethod · 0.45
GetOpCodesMethod · 0.45

Tested by

no test coverage detected