1
0
mirror of https://github.com/v2fly/v2ray-core.git synced 2025-12-25 19:45:38 -05:00

Add Port as a type

This commit is contained in:
V2Ray
2015-12-02 12:47:54 +01:00
parent e8e6cf1429
commit cee85bdf26
16 changed files with 125 additions and 98 deletions

View File

@@ -14,8 +14,8 @@ func TestIntPort(t *testing.T) {
err := json.Unmarshal([]byte("1234"), &portRange)
assert.Error(err).IsNil()
assert.Uint16(portRange.from).Equals(uint16(1234))
assert.Uint16(portRange.to).Equals(uint16(1234))
assert.Uint16(portRange.from.Value()).Equals(uint16(1234))
assert.Uint16(portRange.to.Value()).Equals(uint16(1234))
}
func TestOverRangeIntPort(t *testing.T) {
@@ -36,8 +36,8 @@ func TestSingleStringPort(t *testing.T) {
err := json.Unmarshal([]byte("\"1234\""), &portRange)
assert.Error(err).IsNil()
assert.Uint16(portRange.from).Equals(uint16(1234))
assert.Uint16(portRange.to).Equals(uint16(1234))
assert.Uint16(portRange.from.Value()).Equals(uint16(1234))
assert.Uint16(portRange.to.Value()).Equals(uint16(1234))
}
func TestStringPairPort(t *testing.T) {
@@ -47,8 +47,8 @@ func TestStringPairPort(t *testing.T) {
err := json.Unmarshal([]byte("\"1234-5678\""), &portRange)
assert.Error(err).IsNil()
assert.Uint16(portRange.from).Equals(uint16(1234))
assert.Uint16(portRange.to).Equals(uint16(5678))
assert.Uint16(portRange.from.Value()).Equals(uint16(1234))
assert.Uint16(portRange.to.Value()).Equals(uint16(5678))
}
func TestOverRangeStringPort(t *testing.T) {