v2ray-core/transport/internet/authenticator_test.go

29 lines
822 B
Go
Raw Normal View History

2016-08-08 20:47:59 +00:00
package internet_test
import (
"testing"
2016-10-17 12:35:13 +00:00
"v2ray.com/core/common/loader"
2016-08-20 18:55:45 +00:00
"v2ray.com/core/testing/assert"
. "v2ray.com/core/transport/internet"
2016-10-17 12:35:13 +00:00
"v2ray.com/core/transport/internet/authenticators/noop"
"v2ray.com/core/transport/internet/authenticators/srtp"
"v2ray.com/core/transport/internet/authenticators/utp"
2016-08-08 20:47:59 +00:00
)
func TestAllAuthenticatorLoadable(t *testing.T) {
assert := assert.On(t)
2016-10-17 12:35:13 +00:00
noopAuth, err := CreateAuthenticator(loader.GetType(new(noop.Config)), nil)
2016-08-08 20:47:59 +00:00
assert.Error(err).IsNil()
assert.Int(noopAuth.Overhead()).Equals(0)
2016-10-17 12:35:13 +00:00
srtp, err := CreateAuthenticator(loader.GetType(new(srtp.Config)), nil)
2016-08-08 20:47:59 +00:00
assert.Error(err).IsNil()
assert.Int(srtp.Overhead()).Equals(4)
2016-10-17 12:35:13 +00:00
utp, err := CreateAuthenticator(loader.GetType(new(utp.Config)), nil)
2016-08-08 20:47:59 +00:00
assert.Error(err).IsNil()
assert.Int(utp.Overhead()).Equals(4)
}