1
0
mirror of https://github.com/v2fly/v2ray-core.git synced 2024-12-21 09:36:34 -05:00

Test case for capability

This commit is contained in:
V2Ray 2015-10-01 16:14:05 +02:00
parent 6a2df21727
commit e859ac1d5d
2 changed files with 22 additions and 1 deletions

View File

@ -16,7 +16,7 @@ type listCapabilities struct {
data []Capability
}
func NewCapabilites() Capabilities {
func NewCapabilities() Capabilities {
return &listCapabilities{
data: make([]Capability, 0, 16),
}

21
capability_test.go Normal file
View File

@ -0,0 +1,21 @@
package core
import (
"testing"
"github.com/v2ray/v2ray-core/testing/unit"
)
func TestCapabilities(t *testing.T) {
assert := unit.Assert(t)
caps := NewCapabilities()
assert.Bool(caps.HasCapability(TCPConnection)).IsFalse()
caps.AddCapability(TCPConnection)
assert.Bool(caps.HasCapability(TCPConnection)).IsTrue()
caps.AddCapability(UDPConnection)
assert.Bool(caps.HasCapability(TCPConnection)).IsTrue()
assert.Bool(caps.HasCapability(UDPConnection)).IsTrue()
}