Initial commit
This commit is contained in:
30
bench_test.go
Normal file
30
bench_test.go
Normal file
@@ -0,0 +1,30 @@
|
||||
package protect_trans_info
|
||||
|
||||
import (
|
||||
"fmt"
|
||||
"net/http"
|
||||
"testing"
|
||||
|
||||
"github.com/stretchr/testify/require"
|
||||
)
|
||||
|
||||
func BenchmarkDup(b *testing.B) {
|
||||
c := http.Client{}
|
||||
req, err := http.NewRequest(http.MethodGet, "http://127.0.0.1:8001/43/333", nil)
|
||||
require.NoError(b, err)
|
||||
|
||||
for i := 0; i < b.N; i++ {
|
||||
_, err := c.Do(req)
|
||||
require.NoError(b, err)
|
||||
}
|
||||
}
|
||||
|
||||
func FuzzDup(f *testing.F) {
|
||||
f.Fuzz(func(t *testing.T, firstID uint16, secondID uint16) {
|
||||
c := http.Client{}
|
||||
req, err := http.NewRequest(http.MethodGet, fmt.Sprintf("http://127.0.0.1:8001/%d/%d", firstID, secondID), nil)
|
||||
require.NoError(t, err)
|
||||
_, err = c.Do(req)
|
||||
require.NoError(t, err)
|
||||
})
|
||||
}
|
||||
Reference in New Issue
Block a user