mirror of https://github.com/v2ray/v2ray-core
parent
8c6f73f30b
commit
f1a15e92f5
@ -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