33 lines
695 B
Go
33 lines
695 B
Go
package protect_trans_info
|
|
|
|
import (
|
|
"fmt"
|
|
"net/http"
|
|
"testing"
|
|
|
|
"github.com/stretchr/testify/assert"
|
|
"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) {
|
|
c := http.Client{}
|
|
|
|
f.Fuzz(func(t *testing.T, firstID uint16, secondID uint16) {
|
|
req, err := http.NewRequest(http.MethodGet, fmt.Sprintf("http://127.0.0.1:8001/%d/%d", firstID, secondID), nil)
|
|
assert.NoError(t, err)
|
|
_, err = c.Do(req)
|
|
assert.NoError(t, err)
|
|
})
|
|
}
|