2016-06-02 15:34:25 -04:00
|
|
|
package protocol_test
|
|
|
|
|
|
|
|
import (
|
|
|
|
"testing"
|
|
|
|
|
|
|
|
. "github.com/v2ray/v2ray-core/common/protocol"
|
|
|
|
"github.com/v2ray/v2ray-core/testing/assert"
|
|
|
|
)
|
|
|
|
|
|
|
|
func TestRequestOptionSet(t *testing.T) {
|
|
|
|
assert := assert.On(t)
|
|
|
|
|
2016-06-02 15:48:49 -04:00
|
|
|
var option RequestOption
|
2016-06-02 15:34:25 -04:00
|
|
|
assert.Bool(option.Has(RequestOptionChunkStream)).IsFalse()
|
|
|
|
|
|
|
|
option.Set(RequestOptionChunkStream)
|
|
|
|
assert.Bool(option.Has(RequestOptionChunkStream)).IsTrue()
|
|
|
|
|
|
|
|
option.Set(RequestOptionConnectionReuse)
|
|
|
|
assert.Bool(option.Has(RequestOptionConnectionReuse)).IsTrue()
|
|
|
|
assert.Bool(option.Has(RequestOptionChunkStream)).IsTrue()
|
|
|
|
}
|
|
|
|
|
|
|
|
func TestRequestOptionClear(t *testing.T) {
|
|
|
|
assert := assert.On(t)
|
|
|
|
|
2016-06-02 15:48:49 -04:00
|
|
|
var option RequestOption
|
2016-06-02 15:34:25 -04:00
|
|
|
option.Set(RequestOptionChunkStream)
|
|
|
|
option.Set(RequestOptionConnectionReuse)
|
|
|
|
|
|
|
|
option.Clear(RequestOptionChunkStream)
|
|
|
|
assert.Bool(option.Has(RequestOptionChunkStream)).IsFalse()
|
|
|
|
assert.Bool(option.Has(RequestOptionConnectionReuse)).IsTrue()
|
|
|
|
}
|