github.com/cockroachdb/cockroach@v20.2.0-alpha.1+incompatible/pkg/util/uuid/fuzz.go (about) 1 // Copyright 2019 The Cockroach Authors. 2 // 3 // Use of this software is governed by the Business Source License 4 // included in the file licenses/BSL.txt. 5 // 6 // As of the Change Date specified in that file, in accordance with 7 // the Business Source License, use of this software will be governed 8 // by the Apache License, Version 2.0, included in the file 9 // licenses/APL.txt. 10 11 // Copyright (c) 2018 Andrei Tudor Călin <mail@acln.ro> 12 // Use of this source code is governed by a MIT-style 13 // license that can be found in licenses/MIT-gofrs.txt. 14 15 // This code originated in github.com/gofrs/uuid. 16 17 // +build gofuzz 18 19 package uuid 20 21 // Fuzz implements a simple fuzz test for FromString / UnmarshalText. 22 // 23 // To run: 24 // 25 // $ go get github.com/dvyukov/go-fuzz/... 26 // $ cd $GOPATH/src/github.com/gofrs/uuid 27 // $ go-fuzz-build github.com/gofrs/uuid 28 // $ go-fuzz -bin=uuid-fuzz.zip -workdir=./testdata 29 // 30 // If you make significant changes to FromString / UnmarshalText and add 31 // new cases to fromStringTests (in codec_test.go), please run 32 // 33 // $ go test -seed_fuzz_corpus 34 // 35 // to seed the corpus with the new interesting inputs, then run the fuzzer. 36 func Fuzz(data []byte) int { 37 _, err := FromString(string(data)) 38 if err != nil { 39 return 0 40 } 41 return 1 42 }