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

Function TestWithAsciiOneInsert

texteditor/difflib/bytes/bytes_test.go:262–276  ·  view source on GitHub ↗
(t *testing.T)

Source from the content-addressed store, hash-verified

260}
261
262func TestWithAsciiOneInsert(t *testing.T) {
263 sm := NewMatcher(splitChars(rep("b", 100)),
264 splitChars("a"+rep("b", 100)))
265 assertAlmostEqual(t, sm.Ratio(), 0.995, 3)
266 assertEqual(t, sm.GetOpCodes(),
267 []OpCode{{'i', 0, 0, 0, 1}, {'e', 0, 100, 1, 101}})
268 assertEqual(t, len(getall(&sm.b2j, linePOPULAR)), 0)
269
270 sm = NewMatcher(splitChars(rep("b", 100)),
271 splitChars(rep("b", 50)+"a"+rep("b", 50)))
272 assertAlmostEqual(t, sm.Ratio(), 0.995, 3)
273 assertEqual(t, sm.GetOpCodes(),
274 []OpCode{{'e', 0, 50, 0, 50}, {'i', 50, 50, 50, 51}, {'e', 50, 100, 51, 101}})
275 assertEqual(t, len(getall(&sm.b2j, linePOPULAR)), 0)
276}
277
278func TestWithAsciiOnDelete(t *testing.T) {
279 sm := NewMatcher(splitChars(rep("a", 40)+"c"+rep("b", 40)),

Callers

nothing calls this directly

Calls 8

getallFunction · 0.85
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