2015-11-09 17:52:31 -05:00
|
|
|
package protocol
|
|
|
|
|
|
|
|
import (
|
|
|
|
"testing"
|
2015-11-10 06:13:01 -05:00
|
|
|
|
|
|
|
"github.com/v2ray/v2ray-core/testing/fuzzing"
|
2015-11-09 17:52:31 -05:00
|
|
|
)
|
|
|
|
|
|
|
|
const (
|
|
|
|
Iterations = int(500000)
|
|
|
|
)
|
|
|
|
|
|
|
|
func TestReadAuthentication(t *testing.T) {
|
|
|
|
for i := 0; i < Iterations; i++ {
|
2015-11-10 06:13:01 -05:00
|
|
|
ReadAuthentication(fuzzing.RandomReader())
|
2015-11-09 17:52:31 -05:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
func TestReadUserPassRequest(t *testing.T) {
|
|
|
|
for i := 0; i < Iterations; i++ {
|
2015-11-10 06:13:01 -05:00
|
|
|
ReadUserPassRequest(fuzzing.RandomReader())
|
2015-11-09 17:52:31 -05:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
func TestReadRequest(t *testing.T) {
|
|
|
|
for i := 0; i < Iterations; i++ {
|
2015-11-10 06:13:01 -05:00
|
|
|
ReadRequest(fuzzing.RandomReader())
|
2015-11-09 17:52:31 -05:00
|
|
|
}
|
|
|
|
}
|
2015-11-10 12:16:13 -05:00
|
|
|
|
|
|
|
func TestReadUDPRequest(t *testing.T) {
|
|
|
|
for i := 0; i < Iterations; i++ {
|
|
|
|
ReadUDPRequest(fuzzing.RandomBytes())
|
|
|
|
}
|
|
|
|
}
|