1
0
mirror of https://github.com/v2fly/v2ray-core.git synced 2024-11-02 17:27:50 -04:00
v2fly/testing/assert/bytes.go
2016-11-27 21:39:09 +01:00

35 lines
662 B
Go

package assert
import (
"bytes"
"v2ray.com/core/common/serial"
)
func (v *Assert) Bytes(value []byte) *BytesSubject {
return &BytesSubject{
Subject: Subject{
disp: serial.BytesToHexString(value),
a: v,
},
value: value,
}
}
type BytesSubject struct {
Subject
value []byte
}
func (subject *BytesSubject) Equals(expectation []byte) {
if !bytes.Equal(subject.value, expectation) {
subject.Fail("is equal to", serial.BytesToHexString(expectation))
}
}
func (subject *BytesSubject) NotEquals(expectation []byte) {
if bytes.Equal(subject.value, expectation) {
subject.Fail("is not equal to", serial.BytesToHexString(expectation))
}
}