v2ray-core/transport/internet/header_test.go

28 lines
694 B
Go
Raw Normal View History

2016-12-08 15:27:41 +00:00
package internet_test
import (
"testing"
"v2ray.com/core/testing/assert"
. "v2ray.com/core/transport/internet"
"v2ray.com/core/transport/internet/headers/noop"
"v2ray.com/core/transport/internet/headers/srtp"
"v2ray.com/core/transport/internet/headers/utp"
)
func TestAllHeadersLoadable(t *testing.T) {
assert := assert.On(t)
2017-01-12 21:47:10 +00:00
noopAuth, err := CreatePacketHeader((*noop.Config)(nil))
2016-12-08 15:27:41 +00:00
assert.Error(err).IsNil()
assert.Int(noopAuth.Size()).Equals(0)
2017-01-12 21:47:10 +00:00
srtp, err := CreatePacketHeader((*srtp.Config)(nil))
2016-12-08 15:27:41 +00:00
assert.Error(err).IsNil()
assert.Int(srtp.Size()).Equals(4)
2017-01-12 21:47:10 +00:00
utp, err := CreatePacketHeader((*utp.Config)(nil))
2016-12-08 15:27:41 +00:00
assert.Error(err).IsNil()
assert.Int(utp.Size()).Equals(4)
}