MCPcopy
hub / github.com/prometheus/client_golang / TestWithAsciiOneInsert

Function TestWithAsciiOneInsert

prometheus/internal/difflib_test.go:154–168  ·  view source on GitHub ↗
(t *testing.T)

Source from the content-addressed store, hash-verified

152}
153
154func TestWithAsciiOneInsert(t *testing.T) {
155 sm := NewMatcher(splitChars(rep("b", 100)),
156 splitChars("a"+rep("b", 100)))
157 assertAlmostEqual(t, sm.Ratio(), 0.995, 3)
158 assertEqual(t, sm.GetOpCodes(),
159 []OpCode{{'i', 0, 0, 0, 1}, {'e', 0, 100, 1, 101}})
160 assertEqual(t, len(sm.bPopular), 0)
161
162 sm = NewMatcher(splitChars(rep("b", 100)),
163 splitChars(rep("b", 50)+"a"+rep("b", 50)))
164 assertAlmostEqual(t, sm.Ratio(), 0.995, 3)
165 assertEqual(t, sm.GetOpCodes(),
166 []OpCode{{'e', 0, 50, 0, 50}, {'i', 50, 50, 50, 51}, {'e', 50, 100, 51, 101}})
167 assertEqual(t, len(sm.bPopular), 0)
168}
169
170func TestWithAsciiOnDelete(t *testing.T) {
171 sm := NewMatcher(splitChars(rep("a", 40)+"c"+rep("b", 40)),

Callers

nothing calls this directly

Calls 7

NewMatcherFunction · 0.85
splitCharsFunction · 0.85
repFunction · 0.85
assertAlmostEqualFunction · 0.85
assertEqualFunction · 0.85
RatioMethod · 0.80
GetOpCodesMethod · 0.80

Tested by

no test coverage detected