示例#1
0
文件: ota.go 项目: wangyou/v2ray-core
func ChunkKeyGenerator(iv []byte) func() []byte {
	chunkId := 0
	return func() []byte {
		newKey := make([]byte, 0, len(iv)+4)
		newKey = append(newKey, iv...)
		newKey = append(newKey, serial.IntLiteral(chunkId).Bytes()...)
		chunkId++
		return newKey
	}
}
示例#2
0
func Int(value int) *IntSubject {
	return &IntSubject{value: serial.IntLiteral(value)}
}
示例#3
0
func (subject *IntSubject) LessThan(expectation int) {
	if subject.value.Value() >= expectation {
		subject.Fail(subject.DisplayString(), "is less than", serial.IntLiteral(expectation))
	}
}
示例#4
0
func (subject *IntSubject) GreaterThan(expectation int) {
	if subject.value.Value() <= expectation {
		subject.Fail(subject.DisplayString(), "is greater than", serial.IntLiteral(expectation))
	}
}
示例#5
0
func (subject *IntSubject) Equals(expectation int) {
	if subject.value.Value() != expectation {
		subject.Fail(subject.DisplayString(), "is equal to", serial.IntLiteral(expectation))
	}
}