Ecosyste.ms: Awesome

An open API service indexing awesome lists of open source software.

Awesome Lists | Featured Topics | Projects

https://github.com/lesiw/fill

Package fill fills Go values with random data.
https://github.com/lesiw/fill

fuzzing go go-lib go-test-helper go-testing golang

Last synced: 2 days ago
JSON representation

Package fill fills Go values with random data.

Awesome Lists containing this project

README

        

# lesiw.io/fill

[![Go Reference](https://pkg.go.dev/badge/lesiw.io/fill.svg)](https://pkg.go.dev/lesiw.io/fill)

A utility for filling Go values.

## Example

``` go
package main

import (
"crypto/tls"
"testing"

"github.com/google/go-cmp/cmp"
"github.com/google/go-cmp/cmp/cmpopts"
"lesiw.io/fill"
)

func TestTlsConfigClone(t *testing.T) {
opts := cmp.Options{cmpopts.IgnoreUnexported(tls.Config{})}
for range 100 {
cfg := new(tls.Config)
fill.Rand(cfg)
if want, got := cfg, cfg.Clone(); !cmp.Equal(want, got, opts) {
t.Fatalf("-original +cloned\n%s", cmp.Diff(want, got, opts))
}
}
}
```

[▶️ Run this example on the Go Playground](https://go.dev/play/p/87V0mJqv5qu)