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

39 lines
752 B
Go

package assert
import (
"v2ray.com/core/common/serial"
)
func (v *Assert) Int(value int) *IntSubject {
return &IntSubject{
Subject: Subject{
a: v,
disp: serial.IntToString(value),
},
value: value,
}
}
type IntSubject struct {
Subject
value int
}
func (subject *IntSubject) Equals(expectation int) {
if subject.value != expectation {
subject.Fail("is equal to", serial.IntToString(expectation))
}
}
func (subject *IntSubject) GreaterThan(expectation int) {
if subject.value <= expectation {
subject.Fail("is greater than", serial.IntToString(expectation))
}
}
func (subject *IntSubject) LessThan(expectation int) {
if subject.value >= expectation {
subject.Fail("is less than", serial.IntToString(expectation))
}
}