...

Source file src/github.com/AdamKorcz/go-118-fuzz-build/testdata/first_fuzz_test.go

Documentation: github.com/AdamKorcz/go-118-fuzz-build/testdata

     1  //go:build go1.18
     2  
     3  package compact
     4  
     5  import (
     6  	"testing"
     7  )
     8  
     9  func FuzzRangeNodes(f *testing.F) {
    10  	f.Fuzz(func(t *testing.T, begin, end uint64) {
    11  		if begin > end {
    12  			return
    13  		}
    14  		t.Logf("begin=%d, end=%d", begin, end)
    15  		nodes := RangeNodes(begin%500, end, nil)
    16  		t.Logf("nodes=%v", nodes)
    17  
    18  		// Nodes should be contiguous covering begin to end
    19  		previousEnd := begin
    20  		for _, node := range nodes {
    21  			b, e := node.Coverage()
    22  			if b != previousEnd {
    23  				t.Errorf("got=%d, want=%d", b, previousEnd)
    24  			}
    25  			previousEnd = e
    26  		}
    27  		if previousEnd != end {
    28  			t.Errorf("got=%d, want=%d", previousEnd, end)
    29  		}
    30  	})
    31  }

View as plain text