MCPcopy
hub / github.com/google/go-cmp / compareByte

Function compareByte

cmp/internal/diff/diff_test.go:383–392  ·  view source on GitHub ↗

compareByte returns a Result where the result is Equal if x == y, similar if x and y differ only in casing, and different otherwise.

(x, y byte)

Source from the content-addressed store, hash-verified

381// compareByte returns a Result where the result is Equal if x == y,
382// similar if x and y differ only in casing, and different otherwise.
383func compareByte(x, y byte) (r Result) {
384 switch {
385 case x == y:
386 return equalResult // Identity
387 case unicode.ToUpper(rune(x)) == unicode.ToUpper(rune(y)):
388 return similarResult // Modified
389 default:
390 return differentResult // UniqueX or UniqueY
391 }
392}
393
394var (
395 equalResult = Result{NumDiff: 0}

Callers 3

BenchmarkDifferenceFunction · 0.85
testStringsFunction · 0.85
validateScriptFunction · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected