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

Function TestDifferenceFuzz

cmp/internal/diff/diff_test.go:261–293  ·  view source on GitHub ↗
(t *testing.T)

Source from the content-addressed store, hash-verified

259}
260
261func TestDifferenceFuzz(t *testing.T) {
262 tests := []struct{ px, py, pm float32 }{
263 {px: 0.0, py: 0.0, pm: 0.1},
264 {px: 0.0, py: 0.1, pm: 0.0},
265 {px: 0.1, py: 0.0, pm: 0.0},
266 {px: 0.0, py: 0.1, pm: 0.1},
267 {px: 0.1, py: 0.0, pm: 0.1},
268 {px: 0.2, py: 0.2, pm: 0.2},
269 {px: 0.3, py: 0.1, pm: 0.2},
270 {px: 0.1, py: 0.3, pm: 0.2},
271 {px: 0.2, py: 0.2, pm: 0.2},
272 {px: 0.3, py: 0.3, pm: 0.3},
273 {px: 0.1, py: 0.1, pm: 0.5},
274 {px: 0.4, py: 0.1, pm: 0.5},
275 {px: 0.3, py: 0.2, pm: 0.5},
276 {px: 0.2, py: 0.3, pm: 0.5},
277 {px: 0.1, py: 0.4, pm: 0.5},
278 }
279
280 for i, tt := range tests {
281 t.Run(fmt.Sprintf("P%d", i), func(t *testing.T) {
282 // Sweep from 1B to 1KiB.
283 for n := 1; n <= 1024; n <<= 1 {
284 t.Run(fmt.Sprintf("N%d", n), func(t *testing.T) {
285 for j := 0; j < 10; j++ {
286 x, y := generateStrings(n, tt.px, tt.py, tt.pm, int64(j))
287 testStrings(t, x, y)
288 }
289 })
290 }
291 })
292 }
293}
294
295func BenchmarkDifference(b *testing.B) {
296 for n := 1 << 10; n <= 1<<20; n <<= 2 {

Callers

nothing calls this directly

Calls 2

generateStringsFunction · 0.85
testStringsFunction · 0.85

Tested by

no test coverage detected