Initial commit

This commit is contained in:
2023-08-24 23:40:31 +03:00
commit 49c962e13c
32 changed files with 1360 additions and 0 deletions

30
bench_test.go Normal file
View 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)
})
}