mirror of https://github.com/v2ray/v2ray-core
Darien Raymond
7 years ago
8 changed files with 44 additions and 76 deletions
@ -0,0 +1,27 @@
|
||||
package bitmask_test |
||||
|
||||
import ( |
||||
"testing" |
||||
|
||||
. "v2ray.com/core/common/bitmask" |
||||
"v2ray.com/core/testing/assert" |
||||
) |
||||
|
||||
func TestBitmaskByte(t *testing.T) { |
||||
assert := assert.On(t) |
||||
|
||||
b := Byte(0) |
||||
b.Set(Byte(1)) |
||||
assert.Bool(b.Has(1)).IsTrue() |
||||
|
||||
b.Set(Byte(2)) |
||||
assert.Bool(b.Has(2)).IsTrue() |
||||
assert.Bool(b.Has(1)).IsTrue() |
||||
|
||||
b.Clear(Byte(1)) |
||||
assert.Bool(b.Has(2)).IsTrue() |
||||
assert.Bool(b.Has(1)).IsFalse() |
||||
|
||||
b.Toggle(Byte(2)) |
||||
assert.Bool(b.Has(2)).IsFalse() |
||||
} |
@ -1,34 +0,0 @@
|
||||
package protocol_test |
||||
|
||||
import ( |
||||
"testing" |
||||
|
||||
. "v2ray.com/core/common/protocol" |
||||
"v2ray.com/core/testing/assert" |
||||
) |
||||
|
||||
func TestRequestOptionSet(t *testing.T) { |
||||
assert := assert.On(t) |
||||
|
||||
var option RequestOption |
||||
assert.Bool(option.Has(RequestOptionChunkStream)).IsFalse() |
||||
|
||||
option.Set(RequestOptionChunkStream) |
||||
assert.Bool(option.Has(RequestOptionChunkStream)).IsTrue() |
||||
|
||||
option.Set(RequestOptionChunkMasking) |
||||
assert.Bool(option.Has(RequestOptionChunkMasking)).IsTrue() |
||||
assert.Bool(option.Has(RequestOptionChunkStream)).IsTrue() |
||||
} |
||||
|
||||
func TestRequestOptionClear(t *testing.T) { |
||||
assert := assert.On(t) |
||||
|
||||
var option RequestOption |
||||
option.Set(RequestOptionChunkStream) |
||||
option.Set(RequestOptionChunkMasking) |
||||
|
||||
option.Clear(RequestOptionChunkStream) |
||||
assert.Bool(option.Has(RequestOptionChunkStream)).IsFalse() |
||||
assert.Bool(option.Has(RequestOptionChunkMasking)).IsTrue() |
||||
} |
Loading…
Reference in new issue