1
0
mirror of https://github.com/v2fly/v2ray-core.git synced 2025-12-27 20:45:28 -05:00

simplify testing

This commit is contained in:
v2ray
2016-05-24 21:55:46 +02:00
parent 3582b9d869
commit fc63f0432c
99 changed files with 726 additions and 817 deletions

38
testing/assert/byte.go Normal file
View File

@@ -0,0 +1,38 @@
package assert
import (
"github.com/v2ray/v2ray-core/common/serial"
)
func (this *Assert) Byte(value byte) *ByteSubject {
return &ByteSubject{
Subject: Subject{
disp: serial.ByteToHexString(value),
a: this,
},
value: value,
}
}
type ByteSubject struct {
Subject
value byte
}
func (subject *ByteSubject) Equals(expectation byte) {
if subject.value != expectation {
subject.Fail("is equal to", serial.ByteToHexString(expectation))
}
}
func (subject *ByteSubject) GreaterThan(expectation byte) {
if subject.value <= expectation {
subject.Fail("is greater than", serial.ByteToHexString(expectation))
}
}
func (subject *ByteSubject) LessThan(expectation byte) {
if subject.value >= expectation {
subject.Fail("is less than", serial.ByteToHexString(expectation))
}
}